#include <stdio.h>
int main(void)
{
int x = 99;
int *pt1;
pt1 = &x;
printf("Value at p1: %d\n", *pt1);
printf("Address of p1 (with %%p): %p\n", pt1);
printf("Address of p1 (with %%d): %d\n", pt1);
return 0;
}
What are the downsides/dangers to printer pointer values with %d instead of %p?
%d displays an integer - there is no need for the size of a pointer to equal the size of an integer.
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