I have three examples of differences mentioned below. I donโt understand why ex1 has the same output for ex2 and differs in output for ex3, also why ex2 is not the same as ex3, where I just do the creation on a different line !!
EX1
#include <stdio.h> #include <stdlib.h> int main(void) { int x=2; int *y; y = &x; printf("value: %d\n", *y); printf("address: %d\n", y); return EXIT_SUCCESS; }
Exit
value: 2 address: 2686744
ex2
#include <stdio.h> #include <stdlib.h> int main(void) { int x=2; int *y = &x; printf("value: %d\n", *y); printf("address: %d\n", y); return EXIT_SUCCESS; }
Exit
value: 2 address: 2686744
EX3
#include <stdio.h> #include <stdlib.h> int main(void) { int x=2; int *y; *y = &x; printf("value: %d\n", *y); printf("address: %d\n", y); return EXIT_SUCCESS; }
Exit
value: 2686744 address: 2130567168
I HAVE A BIG CHANGE OF INDICATORS WHEN I THINK THE STAR SHOULD BECOME WITH (y) NOT (int) And I draw that STAR WITH (int) NOT (y) (^_^) NOW EVERYTHING FOR ME ... THANKS FOR ALL OF YOUR ANSWERS
source share