| | |
wat does this do
![]() |
The main method is often misunderstood.
In C89, main() on its own is acceptable, but C99 only allows for either (The second one is for command line paramaters):
In C89, main() MUST return something but C99 says if a return statement is absent, then 0 is implied (sucess). I do however think this has been removed in newer standards. This is as when C was new, void did not exist and the machines of the time required that the program return an integer value for sucess or not. Anything other that 0 (sucess) was logged.
In C++ there is allowed
Note that int main() is NOT void. The empty brackets do NOT indicate no paramaters, they in fact indicate an unlimited number of paramaters.
The ISO C Standard (ISO/IEC 9899:1999) says it is also illegal for C++ to have a return type of void. The return type should be an integer and the function should return 0 or EXIT_SUCCESS; at the end. A return type of void does NOT mean it returns nothing, it just means it returns a junk value which will pribably not be 0.
I do hope thats right, that just my understanding from my notes.
In C89, main() on its own is acceptable, but C99 only allows for either (The second one is for command line paramaters):
•
•
•
•
int main ( void )
int main ( int argc, char *argv[] )
In C++ there is allowed
•
•
•
•
int main ( int argc, char *argv[] )
int main ()
The ISO C Standard (ISO/IEC 9899:1999) says it is also illegal for C++ to have a return type of void. The return type should be an integer and the function should return 0 or EXIT_SUCCESS; at the end. A return type of void does NOT mean it returns nothing, it just means it returns a junk value which will pribably not be 0.
I do hope thats right, that just my understanding from my notes.
If i am helpful, please give me reputation points.
![]() |
Similar Threads
- Can anyone figure out what is wrong in my program? (C++)
- Wat is shell? (Shell Scripting)
- wat type of cvsnt should be used for asp.net (ASP.NET)
- wat is flag??pls...can someone explain it to me!! (C)
- Wat is method compareTo? (Java)
- wat list??? (Computer Science)
- ntfsd.exe, winrbd32.exe, mwupdate32.exe wat are these (Windows NT / 2000 / XP)
- Can't get samba to work! (*nix Software)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- images no longer animated (Web Browsers)
Other Threads in the Assembly Forum
- Previous Thread: code snipp
- Next Thread: using STDCALL
| Thread Tools | Search this Thread |






