Sunday, December 27, 2009

FUNCTION main

Function is a base of C++ program arrangement. So, it will always be exist in C++ program. At least, you'll have one function in your C++ program. This essential function is called as "function main."
#include

void main()
{
        cout << "Welcome to C++";
}
In the program above, main is the name of the function. Meanwhile, void is a statement to state that the function has no return value.

Everything shown from "{" to "}" is called as block. "{" is to show the beginning of the program, and "}" is to show the end of the program.


The character "(" and ")" are used to fill the argument of function main. In the example above, the () is empty. It means that the function main has no argument.

No comments:

Post a Comment

Please type your comment here!