This program goes against everything I have been taught and learned in C. How does this compile? Why does this not need to be int main? Why no return 0? Don't you need an initial declaration of sub() above main? That bugs the crap out of me. I like keeping my functions above main.
#include <stdio.h>
main()
{
sub ();
sub ();
}
sub()
{
static int y = 5;
printf(" y is %d \n",y);
y++;
}
The gcc version is:
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
This is an old version it seems but not to crazy old.
https://www.gnu.org/software/gcc/releases.html
How do I check if this is c90 or c89?
gcc -std=c11 -pedantic-errorsthen gcc is not a strictly conforming C compiler, but a non-standard one compiling against a ton of weird GNU extensions.gcc -std=c90 -pedantic-errors? Wikipedia is making it sound like c11 isn't supported till gcc version 4.6. en.wikipedia.org/wiki/C11_%28C_standard_revision%29 I already provided the version I'm using.