FactChecker
Science Advisor
Homework Helper
- 9,257
- 4,571
Suppose your main() had a line like:
Then your function PostfixInc could return an error code and it would be checked by main() and appropriate actions could be taken.
C++:
int anErrorOccured = 0;
...
...
int PostfixIncReturnValue = PostfixInc();
if( PostfixIncReturnValue != 0 ){
cout << "ERROR: Could not PostfixInc. Error code = " << PostfixIncReturnValue << endl;
...
... (take appropriate corrective action)
...
anErrorOccured = 5; // Error code 5 indicates that a problem occurred in PostfixInc
}
...
...
return anErrorOccured;