You’re already given the function signature: int largest()
, so that’s exactly how you’d write the function (exactly like int main();
):
// Declares the function
int largest();
// Defines the function:
int largest()
{
// The function MUST return an int (or something convertible) otherwise it will not compile
return 0;
}
Or you can combine the declaration with the definition:
int largest()
{
return 0;
}
1
solved how to write a function for numbers