cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
regarding main function
regarding main function
Feb 15, 2013 at 4:58am UTC
sriram vallabhaneni
(1)
what is the use of 'int' in the command 'int main ()'?
Feb 15, 2013 at 5:36am UTC
palauan73
(47)
it's the return type. When you have
int main()
{
return 0;
}
It's basically a function that takes in no parameters and returns the integer 0;
Feb 15, 2013 at 6:25am UTC
Darkmaster
(564)
just that you don't need to write return 0; or any other integer value
Feb 15, 2013 at 6:39am UTC
JLBorges
(13770)
The int returned by main() is a way for a program to return a value to "the system" that invokes it. On systems that doesn't provide such a facility the return value is ignored...
http://www.stroustrup.com/bs_faq2.html#void-main
Feb 15, 2013 at 10:39am UTC
plexus
(147)
On the command line this return code can be found in the environment variable ERRORLEVEL.
In the Powershell it's the variable $LastExitCode.
1
2
void
main(){ }
works with most compilers / libraries, too.
Feb 15, 2013 at 11:01am UTC
Lodger
(128)
1
2
void
main(){ }
works with most compilers / libraries, too.
Regardless of whether it works or not, it's still wrong
Topic archived. No new replies allowed.