How is the main() function declared?

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.

Questions by GeekAdmin   answers by GeekAdmin

 

This Question is not yet answered!

 
 

Related Answered Questions

 

Related Open Questions