what is output for this code?don't mention the header file r some thing just answer for concept of postfix and prefix | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is output for this code?don't mention the header file r some thing just answer for concept of postfix and prefix

int a=10,b; b=++a+a+++++a+a++; cout<<b; cout<<a;

5th Jul 2016, 6:39 AM
raju
raju - avatar
9 Answers
+ 2
Yoy dont need return 0 in the main function in modern compilers. The return statement is implied.
5th Jul 2016, 1:14 PM
Garme Kain
Garme Kain - avatar
+ 1
Compiler error
5th Jul 2016, 6:52 AM
Mihai Dancaescu
Mihai Dancaescu - avatar
+ 1
And main() is INT. Also, you have no return 0; or using namespace std;.
5th Jul 2016, 6:53 AM
Mihai Dancaescu
Mihai Dancaescu - avatar
0
answer is 48 14 becoz 10 will change as 12 due to prsence of two prefix then a value is reflected as 12 so 12×4=48 then the value of a is 14 becoz of increment of postfix after the code is ended i.e after semicolon
5th Jul 2016, 2:20 PM
raju
raju - avatar
0
this is meaningless.
5th Jul 2016, 2:34 PM
CWB
0
how u saying why
5th Jul 2016, 2:37 PM
raju
raju - avatar
0
this concept in my 12 th std book
5th Jul 2016, 2:38 PM
raju
raju - avatar
- 1
how
5th Jul 2016, 6:54 AM
raju
raju - avatar
- 3
those who know answer for this r well know the concept of postfix and prefix
5th Jul 2016, 6:41 AM
raju
raju - avatar