C++ Programming - References - Discussion
Discussion Forum : References - Programs (Q.No. 2)
2.
Which of the following statement is correct about the program given below?
#include<iostream.h>
int main()
{
int x = 80;
int &y = x;
x++;
cout << x << " " << --y;
return 0;
}
Discussion:
17 comments Page 2 of 2.
Demented_hedgehog said:
10 years ago
There's no sequence point for the << operator so the order of evaluation is unspecified.
Hatos said:
8 years ago
My output is;
81 80
Code::Blocks
Release 17.12 rev 11256
g++.exe (GCC) 7.2.0
std = c++1z
81 80
Code::Blocks
Release 17.12 rev 11256
g++.exe (GCC) 7.2.0
std = c++1z
(1)
Sid said:
4 years ago
In C++17 answer is 81 80 and in C++ 14 ans is 80 80.
(4)
Anant Supekar said:
5 years ago
The correct answer will be 81 80.
(3)
Bhavesh Garg said:
2 years ago
The Correct Answer is (B) 81 80.
(15)
Anusha said:
5 years ago
The correct answer is 81 80.
(4)
Serg said:
7 years ago
Of course, it is 81 80.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers