0
{ int a = 100; a = 50; cout << a; return 0; } Why the output is 50 as the value of a is 100 & 50
7 Answers
+ 4
The work is with these lines
int a = 100;
a =50
You first thing tell C++ to give "a" the value 100
The second line tells C++ to replace the former value of "a"(100) , with a new value (50)
+ 3
the second value replace the first value...
so 100 be 50
+ 2
but what did you expect to change the initial value of 100 to 50? Variables can not store multiple values ââif they are neither structures, nor classes, nor unions
0
they are right
0
ahhh c++ :-)
0
As after intializing the value of a to 100 its value is changed to 50
0
the program changed the output to 50 becsause u told it to :)
u changed the value from 100 to 50