And also why the one at the end does not have semicolon after its paranteses!!!!???
Because one is a function declaration(or function prototype), and the other is a function definition. A function declaration is just the function header:
Code:
int mult( int x, int y)
{
return x*y;
}
followed by a semicolon, and alerts the compiler not to produce an error because the function definition will follow later.
You could just put all your function definitions before main(), and avoid most problems like that, but what if you have a function A() that in certain cases calls a function B(), and function B() in turn calls A() in certain cases. If you put the definition of A() first, then the compiler will see a call to B() inside A(), and it will complain that B() isn't defined. The same thing will happen if you put the definition of B() first. Therefore, C++ provides a way around that problem with function declarations. You would do this:
Code:
void B(int x, int y);
void A(int h, int i)
{
...
if(something == something_else)
B(1, 2);
}
void B(int x, int y)
{
...
...
if(this == that)
A(10,20);
}