I know that in modern C when we declare a function that has no parameter we must specify the void keyword like :
int fx(void);
However I have some doubts when it comes to function definitions. For example, are these two definitions the same ?
int fx(){} /* it is as if it was void */
int fx(void){}
I guess these two definitions are the same because I see a lot of code out there that omit the void keyword in the parameter....
Before C23, if the parameter is
voidin the declaration, the compiler will be able to detect an error if the function is called with some parameter :On the other hand, if there's no parameter in declaration, the compiler won't check parameters on function call :