C ++ Commands
C ++ Commands
// definition of foo:
void foo()
{
cout << "Listen!" << endl;
int i = bar(42);
}
- All definitions are also declarations
- A function definition must NOT contain a semi-
colon (‘;’) after the parameter-list
- function definition is followed by a compound
statement containing the function body. It is the
function body which defines the function.
Syntax for Functions // Function definition
return-value-type function-name( named-
parameter-list)
{
declarations-and-statements
}
// Function prototype
return-value-type function-name( parameter-
list);
// Function signature
function-name( parameter-list)