#include <stdio.h>
#include <stdlib.h>
main ()
{
int a=6,b=7;
printf("%d,%d\n",a,b);
{
int b=10;
printf("%d,%d\n",a,b);
}
printf("%d,%d\n",a,b);
}
输出结果是:6,7 6,10 6,7
我不明白为什么打三个输出是6,7
求指导,自学c语言,没有老师问
#include <stdio.h>
#include <stdlib.h>
main ()
{
int a=6,b=7;
printf("%d,%d\n",a,b);
{
int b=10;
printf("%d,%d\n",a,b);
}
printf("%d,%d\n",a,b);
}
输出结果是:6,7 6,10 6,7
我不明白为什么打三个输出是6,7
求指导,自学c语言,没有老师问
你有三次输出啊
第一个输出的时候你定义的a=6,b=7,输出的a和b就是6,7
第二次输出的时候你重新定义了b=10,a没有重新定义,所以输出结果是6,10
第三次输出的时候,第二次你重新定义的那个b已经结束了,所以输出的结果还是和第一次的一样,是6,7