C++ Programming - References - Discussion
Discussion Forum : References - Programs (Q.No. 4)
4.
Which of the following statement is correct about the program given below?
#include<iostream.h>
int main()
{
int x = 10;
int &y = x;
x = 25;
y = 50;
cout<< x << " " << --y;
return 0;
}
Discussion:
13 comments Page 2 of 2.
Anant Supekar said:
5 years ago
The correct answer will be 50 49.
Anusha said:
5 years ago
The answer is 50 49 as x is printed first its value is 50 and then why is decremented.
Ovidiu said:
4 years ago
Starting from the standard c++17 result will be:
50 49.
In this standard, they changed std::cout.
50 49.
In this standard, they changed std::cout.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers