using namespace std;
void myFunction() {
// Local variable that belongs to myFunction
int x = 5;
}
int main() {
myFunction();
// Print the variable x in the main function
cout << x;
return 0;
}
prog.cpp: In function ‘int main()’: prog.cpp:13:11: error: ‘x’ was not declared in this scope 13 | cout << x; | ^