ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
int main( void ) doesn't take any arguments, and returns an integer which usually indicates success or failure. Usually you won't care much about what main's return value is, but I suppose you could use it to tell whoever called it whether it had an error or not. void main() and void main(void) are the same. The empty parentheses imply no arguments to main, just as with any other function. The void return value means you don't need to return anything from main, although I think the standard practice is to use an int return value (and some compilers will even force you to use int as the return value).
well it's worth it to take a look and see what exactly main is returning to.
Code:
exit(main(argc, argv));
seeing this it is clear that main should ALWAYS return a value. however it is optional
for main to have argc,argv. if they are not there, void should be. so, you should have either:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.