what is the difference between int main(void ) and int main() in c


10/22/2019 1:54:34 AM

Rajith Reddy

1 Answer

New Answer


The 1st definition with void (int main(void)) is considered a bit better as it specifies that main can only be called without any parameter. In C, if a function signature doesn’t specify any argument, it means that the function can be called with any number of parameters or without any parameters.  Both work fine, but it's technically better to specify when there are no parameters