adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    namespace first
    {
        int var = 5;
    }
    namespace second
    {
        double var = 3.1416;
    }
    int main ()
    {
        int a;
        a = first::var + second::var;
        cout << a;
        return 0;
   }

a.

8.31416

b.

8

c.

9

d.

compile time error

Answer: (b).8

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?