#include <stdio.h>
int main(void)
{
int cnt; // 지역변수 main 소속
for(cnt=0; cnt<3; cnt++) // 0 1 2 3
{
int num=0; // 지역변수 for 소속
num++; // 1
printf("%d번째 반복, 지역변수 num은 %d. \n", cnt+1, num);
}
if(cnt==3)
{
int num=7; // 지역변수 if 소속
num++; // 8
printf("if문 내에 존재하는 지역변수 num은 %d. \n", num);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: