| | |
Return 0; and system ("pause")
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
•
•
Please can anybody tell me the difference in return 0 and system ("pause");
system() is a library function that makes calls to OS commands/programs. system("pause") calls the "pause" command in DOS/Windows. Run the pause command in a command shell to see what it does.
Manic twiddler of bits
•
•
Join Date: Jul 2009
Posts: 12
Reputation:
Solved Threads: 0
•
•
•
•
Can you tell me the difference between the sky and the earth...!!!..??
your question and my question are similar...,..They have no relation to differentiate them..
things .
•
•
•
•
Can you tell me the difference between the sky and the earth...!!!..??
your question and my question are similar...,..They have no relation to differentiate them..
Manic twiddler of bits
•
•
Join Date: Aug 2008
Posts: 92
Reputation:
Solved Threads: 2
•
•
•
•
the sky is what holds the snow and water and also the hanging place for the big light mean while the earth is the gruond on which we will walk and do all other
things .
C Syntax (Toggle Plain Text)
system("pause");
But the
C Syntax (Toggle Plain Text)
return 0;
•
•
•
•
statement is a type of statement which is written at the last of any function which has its return type as integer(commonly).This is like a command saying "NOTHING TO DO" at the last of the functions definition.C Syntax (Toggle Plain Text)
return 0;
Saying something like "it's a command saying "NOTHING TO DO" is WRONG!!! Have you ever checked the return value of the fopen() function and what it potentially means? If you assumed that the return value of this function means "nothing to do", then you may be in for a rude shock.
It's been a month since I began participating in this forum and I cannot believe some of the misnomers that are put forward.
Sheesh!!!
Manic twiddler of bits
•
•
Join Date: Aug 2008
Posts: 92
Reputation:
Solved Threads: 2
In case of main function, if i forgot to write return 0; at the last, GCC compiler generates no error , what i found is that.
So I said that return 0; means nothing to do.
I know about the importance of return statement in other built-in functions and user defined functions.
But in case of main function if return 1; or other would have some meaningful sense, but return 0; has no sense.
So I said that return 0; means nothing to do.
I know about the importance of return statement in other built-in functions and user defined functions.
But in case of main function if return 1; or other would have some meaningful sense, but return 0; has no sense.
•
•
•
•
In case of main function, if i forgot to write return 0; at the last, GCC compiler generates no error
Coding in C takes more work because the compiler does not try to protect you from every possible mistake.•
•
•
•
But in case of main function if return 1; or other would have some meaningful sense, but return 0; has no sense.
If you compile with std=c99, you can omit the return statement because C99 implicitly returns 0 if execution falls off the end of main without an explicit return statement. Otherwise,
return 0; is a very good idea. If it still makes no sense to you, try return EXIT_SUCCESS; and include <stdlib.h>. That might look like more work is being done.
-Tommy (For Great Justice!) Gunn
![]() |
Similar Threads
- Replacement for system("PAUSE") ? (C++)
- Replacing system("pause"); with a function (C++)
- system( "PAUSE" );!!!! (C++)
- system("pause"); (C++)
- system("PAUSE") (C++)
Other Threads in the C Forum
- Previous Thread: Can't see error in my program
- Next Thread: Linker Error
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks bash binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory dynamic fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h





