0

The exercise tells me to find the error in this code

int g()
{
cout << "Inside function g" << endl;
int h()
{
cout << "Inside function h" << endl;
}
}

The listed error is that function h should not be defined inside of function g. I understand that. But aren't functions h and g supposed to return an int? It's not listed in the book answer section as an error, but it seems fishy.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Ancient Dragon
0

Yes they should return an int, but the author probably omitted that just to simplify the code and illustrate the intended problem.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.