C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - Programs (Q.No. 6)
6.
What will be the output of the following program?
#include<iostream.h> 
class India
{
    public:
    struct Bix
    {
        int   x;
        float y;
        void Function(void)
        {
            y = x = (x = 4*4); 
            y = --y * y;
        }
        void Display()
        {
            cout<< y << endl;
        } 
    }B; 
}I; 
int main()
{
    I.B.Display(); 
    return 0;
}
0
1
-1
Garbage value
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
25 comments Page 3 of 3.

Pooja said:   1 decade ago
Is it displaying the default value of y i.e.=0;

Sonal said:   1 decade ago
How can default value be '0' in this case ?

Scorpionsrk7 said:   9 years ago
What is the B and L in this program?

Dhruv said:   1 decade ago
Why its not garbage ?

Swati said:   1 decade ago
Why it's not 1?


Post your comments here:

Your comments will be displayed after verification.