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.

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