I'm a little bit confused about why the below compiles. I've tried looking into some resources to explain it (Kernighan's The C Programming Language) but to no avail. My confusion arises from why the last part of the compound declaration works. My understanding is that the "int" at the start of the line applies to every subsequent variable (hence why they are all initialized as ints). If this is so, then why is it not illegal to redefine nmax which has global scope?
int nmax = 20;
/* The main() function */
int main ( int argc , char ** argv ){ // entry point
int a = 0, b = 1, c, n, nmax = 25;
printf ( "%3d: %d\n",1 ,a );
printf ( "%3d: %d\n",2 ,b );
for (n = 3; n <= nmax; n++) {
c = a + b; a = b; b = c;
printf ( "%3d: %d\n",n, c );
}
}