In this piece of code, why in my testing the result is always 1
, 2
, and 3
?
#include <stdio.h>
void test() {
int a;
a++;
printf("%d",a);
}
int main(int argc, char *argv[]) {
test();
test();
test();
}
I think the variable in test()
is static, isn't it? And Why?