What exactly happens when you convert a pointer to a non-pointer type?
For example:
int i = 7;
int *y = &i;
printf("%x %d %x", y, (int)y,7);
The result when compiled and run is:
29ff00 2752256 7
But what actually resulted - where did the number come from? Is it a random number or something related to what the pointer held?
Does it have a mathematical value such as the address or is the value of the pointer converted by some standard?
2752256 is the decimal value of the memory address 29ff00. You'd get a similar result with
printf("%x %d", y, y);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With