Printf ubuntu Segmentation fault (core dumped)
- by Someone
I have this code:
int a;
printf("&a = %u\n",(unsigned)&a);
printf("a\n");
printf("b\n");
printf("c\n");
printf("d\n");
I tried to print the pointer of a variable.
But it fail on the row printf("a\n"); and says Segmentation fault (core dumped)
Output:
&a = 134525024
Segmentation fault (core dumped)
When I remove the row printf("&a = %u\n",(unsigned)&a); from the code, its success.
Output:
a
b
c
d
What worng in my code?