In c++, any variables declared in main will be available throughout main right? I mean if the variables were declared in a try loop, will they would still be accessible througho
The scope of number is limited to the try block. Pull out this declaration to the main scope to access the variable after the try block:
number
try
main
int main() { int number = 0; try { // do something... } catch (...) { cout <<"Error"; } number ++; cout <