LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-02-2002, 06:08 AM   #1
gurra
LQ Newbie
 
Registered: Sep 2001
Distribution: Flyinglinux
Posts: 12

Rep: Reputation: 0
Question int main()


why use "int main()" when you can use "void main()"?
 
Old 02-02-2002, 06:28 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,398

Rep: Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965
it's always good to return an exit code from a program. the value you reply can infer wether the program executed correctly. nearly all programs return exit codes. for example...

[chris@trevor chris]$ ls hello
ls: hello: No such file or directory
[chris@trevor chris]$ echo $?
1
[chris@trevor chris]$ touch hello
[chris@trevor chris]$ ls hello
hello
[chris@trevor chris]$ echo $?
0
[chris@trevor chris]$

so from this we can tell if ls was successful or not.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
invalid types int[int] for array subscript scuzzman Programming 2 11-16-2004 09:34 PM
main(int argc, char **argv) Longinus Programming 4 06-12-2004 07:22 AM
Strings and int? kalleanka Programming 12 02-10-2004 04:34 AM
string to int in C h/w Programming 2 12-05-2003 03:47 PM
int arr[2]={23,12,45}; aditya Programming 1 03-03-2003 09:32 AM


All times are GMT -5. The time now is 05:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration