The declaration of main can be done as

int main()

 

One more declaration that can be taken by main is command line arguments form namely

int main(int argc, char *argv[])

Or This can also be written as

int main(argc, argv)
int argc;
char *argv[];

One of the important point to note is it is not possible for one to declare the main() as void. This is because the function main() returns int only and if the function is declared as returning void by statement void main() there is mismatch in declaration and hence this would not work.So main() must be declared as returning int which takes the form by int main() Or simple main() meaning int value returned.

 



Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request please get @me on
linkedin FaceBook Twitter Google Plus