whats the diff between int main (), main (), int main (void), and main (void) ???
whats the diff between int main (), main (), int main (void), and main (void) ???
Children in the dark make accidents.
Accidents in the dark make children.
i guess i should have checked this website first...
thanks
Children in the dark make accidents.
Accidents in the dark make children.
This is what will happen to you if you use void main()--check out Salem's picture:
http://cboard.cprogramming.com/showt...5&pagenumber=1
You should never use void main...if not because of salem's god-given right to injure you, then because it isnt even c++, have a read.
http://www.research.att.com/~bs/bs_faq2.html#void-main
why do compilers accept it and why do professors and books teach it?
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT
because it wasn't the standard then i guess.
Under regular function calling/returning in C and C++, if your don't ever want to return anything from a function, you define it's return type as void. For example, a function that takes no arguments, and returns nothing can be prototyped as:
void foo(void);
A common misconception is that the same logic can be applied to main(). Well, it can't, main() is special, you should always follow the standard and define the return type as int.