regarding main function

what is the use of 'int' in the command 'int main ()'?
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;
just that you don't need to write return 0; or any other integer value
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
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.
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.