main() method requirements – briefly

Q: in c++ what signatures can main() have?
AA: return type must be “int”
int main() //tested
int main(int argc, char *argv[]) //tested
void main() //won’t compile.

Q: in c++ must main() actually return an int?
AA: No need. I never have a “return” statement in my main().

——– c# ———-
Main() can only declare to return int or void.
Main() can be private

Advertisements
Posted in IKM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s