I am learning C. Why doesn't the static variable increase above1.
#include <stdio.h>
int foo()
{
static int a = 0;
return a+1;
}
int main()
{
int i;
for (i = 0; i < 10; i = foo())
printf("%d\n", i);
return 0;
}
Where is the mistake in this code ?