What is the output of the following C program?
#include <stdio.h>
int main(void) {
for (int i = 0; i < 3; i++) {
static int s = 0;
int a = 0;
s++;
a++;
printf("%d%d ", s, a);
}
printf("\n");
return 0;
}
The static s is initialised once and keeps counting. The automatic a is created and set to 0 on every pass of the loop body, so it is always 1 after a++.