This main() does not conform to anything I can find in K&R, or any textbook, or C draft standard, but GCC compiles it with no complaints & it runs without errors. (Call it with no arguments.)
I also find that I can specify other types for the parameters, as inCode:#include <stdio.h>
main(x,y,z)
{
printf("Hello world!\n");
printf("x = %d, y = %d, z = %d\n",x,y,z);
y = 2*x;
if(x == 5)
return;
else
main( x+1,y,100 );
}
or add any number and type of additional parameters -- in fact, apparently to do anything with main that I can with any other function, plus it seems that the parameters are ints by default, with no need to specify a type unless I want some non-numeric type.Code:main(x,y,z) double y; char z;
{
//...
}
Why does this work? Is this just a nonstandard "feature" to let us have fun obfuscating code, or is there a better explanation?