0
%x
What is the problem in 1st and 2nd printf function getting errors #include <stdio.h> int main() { int j = 63; int *p = NULL; p = &j; printf("The address of j is %x\n", &j); printf("p contains address %x\n", p); printf("The value of j is %d\n", j); printf("p is pointing to the value %d\n", *p); }
4 ответов
0
Hey Surya Raj
1. What is %x , I don't understand?
2.is your question that you are getting some value for 1st and 2nd printf fn ,they are the memory address of that variable.
I think this code help you 👇
#include <stdio.h>
int main() {
int j = 63;
int *p=NULL;
p = &j;
printf("The address of j is %ld\n", &j);
printf("p contains address %ld\n", p);
printf("The value of j is %d\n", j);
printf("p is pointing to the value %d\n", *p);
return 0;
}
+ 2
Surya Raj , The correct format specifier for printing address is %p.
Replace %x with %p.
0
It is printing one type of garbage value because the value changes when you re-run it
0
Ok