A user defined funtion is one that has a proper signature i.e. name, return type (optional in some cases) and arguments e.g.
//function declaration, can optionally be written outside
//the 'main' function
bool myFunction(int x, int y);
//the funtion returns true if y is divisible by x,
//otherwise it returns false
bool myFunction(int x, int y)
{
if(x%y == 0)
return true;
else
return false;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment