Question: Determine the values displayed by each cout statement in the following program: #include using namespace std; int firstnum = 1 0 ; / / declare

Determine the values displayed by each cout statement in the following program:
#include
using namespace std;
int firstnum =10; // declare and initialize a global variable
void display(); // function prototype
int main()
{
int firstnum =20; // declare and initialize a local variable
cout <<"
The value of firstnum is "<< firstnum << endl;
display();
return 0;
}
void display(void)
{
cout << "The value of firstnum is now "<< firstnum << endl;
return;
}

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!