Why does this C program compile?
- by AdmiralJonB
I've just come across someone's C code that I'm confused as to why it is compiling. There are two points I don't understand.
First, the function prototype has no parameters compared to the actual function definition. Secondly, the parameter in the function definition doesn't have an type.
#include <stdio.h>
int func();
int func(param)
{
return param;
}
int main()
{
int bla = func(10);
printf("%d",bla);
}
Could someone please explain to me why this works? I've tested it in a couple of compilers and it works fine.