我有一些代码如下:
#include <stdio.h>
#include <stdlib.h>
static counter = 0;
static flag = 0;
int main()
{
int number = 3;
int i = 0;
for(i; i< number; i++)
{
if(counter >= number)
{
counter = 0;
flag = 1;
}
counter ++;
printf(" counter = %u\n", counter);
printf(" flag = %u\n", flag);
}
return 0;
}
每次计数器达到3时,标志应该是1,但是为什么当计数器达到3时,标志仍然是0?