Hello! I'm not able to understand some typecasting syntaxes. For eg.
float f=7.0;
short s=*(short *)&f;
What's happening here short s=*(short *)&f
? Looks like we're casting something
as a pointer to a short and then initializing s
to value stored in the address pointed to by something
.
Now, this something
looks like the address of variable f
. So if something
= address of f
, it appears to me that we are making address of f
as a pointer to some short and then de-referencing it. I know that what I've stated is wrong, but I just can't seem to visualize it.
Thanks.