1、递归
输出结果将循环输出,即无限输出
2、外部count和内部count
include <stdio.h>
#include <stdlib.h>
int main()
{
int count=0;
do{
int count =0;
count++;
printf("count = %d\n",count);
count++;
}while(count <5);
printf("count = %d\n",count);
return 0;
}
此时外部循环保持不变,内部循环只加1,输出结果将持续为1;
3、内部变量不受外界变量影响
#include <stdio.h>
#include <stdlib.h>
void changeNum()
{
int num1=5,num2 =8;
num2 =288;
num1 =55;
}
int main()
{
int num1 =5,num2 =8;
changeNum();
printf("num1=%d\tnum2=%d\n",num1,num2);
return 0;
}
输出结果为