#include<stdio.h>
int main(){
int a=100;
printf("aaaaa%n",&a);
printf("%d",a);
}
I used gcc to compile it ( :gcc a.c ) however, its output is as follows
aaaaa100
The value of a
doesn't change by the printf
's %n
format string
I suppose it should output as follows
aaaaa5
What is the reason of this unexpected difference? Thank you