#include <stdio.h>


void foo(void);

int x = 1;


int main(void) {

int x = 2;

printf("%d", x);

foo();

{

int x = 3;

x++;

}

printf("%d", x);

return 0;

}


void foo(void) {

printf("%d", x);

}


출력결과가 212 인데

앞에 2는 지역변수라서 알겠는데
뒤에 12는 어떤원리로 나오는건가용?