When are void as function arguments useful?
#include "stdlib.h" #include "stdio.h" void foo(); int main() { foo(5);
In the above snippet, although the prototype foo() has no arguments, it is still valid to pass anything to it. So, to avoid such events -
void foo(void) ;
It is now guaranteed that passing anything to foo() will lead to compiler errors.
source share