Question: void someFunction ( ) { int x = 9 9 ; cout < < x < < endl; } int main ( ) { int

void someFunction(){
int x =99;
cout << x << endl;
}
int main()
{
int x =23;
someFunction();
return 1;
}
3.1 Is the above allowed? In other words, can both main() and someFunction() have a variable with the same name 'x'?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!