What will the following two-file program display? // file1.cpp #include using namespace std; void other(); void another();

Question:

What will the following two-file program display?
// file1.cpp
#include
using namespace std;
void other();
void another();
int x = 10;
int y;
int main()
{
cout << x << endl;
{
int x = 4;
cout << x << endl;
cout << y << endl;

}
other();
another();
return 0;
}
void other()
{
int y = 1;
cout << "Other: " << x << ", " << y << endl;
}
// file 2.cpp
#include
using namespace std;
extern int x;
namespace
{
int y = -4;
}
void another()
{
cout << "another(): " << x << ", " << y << endl;
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

C++ Primer Plus

ISBN: 9780321776402

6th Edition

Authors: Stephen Prata

Question Posted: