want to know about function

closed account (i2v7M4Gy)
Wat is a function and wat main function does and why int comes before it and () comes after it as it is written as


int main().
Try reading this: http://www.cplusplus.com/doc/tutorial/functions.html
int main() is the entry point in C and C++ (where the program begins)
int comes before it because it returns and integer value after the program has finished, where 0 means that the program executed correctly.

() comes after it because some functions inherit variables from other functions, and these are declared in the brackets. Since main is the starting point of the program, it can't inherit any variables. (not local ones anyway)
Since main is the starting point of the program, it can't inherit any variables

Tipical main arguments are (int argc, char *argv[])
Last edited on
damn, I knew there would be an execption...
I was just trying to sound clever...
Last edited on
Topic archived. No new replies allowed.