void main()
{
int i=5;
printf("%d",i+++++i);
}
Answers were Sorted based on User's Feedback
Answer / nagarajan
If it is i++ + ++i the output will be 12 because
i++ =6
++1 =6
6+6=12
but in this case continuous five plus will show error .
compiler cannot identify operands there must be a space in between
Is This Answer Correct ? | 55 Yes | 21 No |
Answer / junaid
well if you write all 5+ without space then it will give an error because compiler will not recognize it
you can write i++ + ++i or ++i + i++
answer in both statements will be 12
Is This Answer Correct ? | 16 Yes | 7 No |
Answer / harshawardhan
all functions pass the value from right to left and printf()
is one function therefore
i++ + ++i
in this siquence first solve the ++i and then solve the i++
first incrment by one i.e. 6 and then it solve i++ i.e. 5
printf("%d",i++ + ++i);
printf("%d",i++ + 6);
printf("%d",6 + 6);
printf("%d",12);
And therefoe output is:-
12
Is This Answer Correct ? | 13 Yes | 9 No |
Answer / gaurav tyagi
first of all
i want to say every one plz write ans if you are fully confident otherwise run it
///in this program a error is occurs because compiler not recognize the code <i am run this one>
Is This Answer Correct ? | 3 Yes | 3 No |
Answer / srinivas
printf allways it will work from right to left so first
++i=6 after that i++ also 6 so 6+6=12 ..
Is This Answer Correct ? | 9 Yes | 10 No |
Answer / vns
Increment operator(++i) only increases i value. At first ++i, i value becomes 6. Then there's another ++i, now i value is 7. both increment operations are evaluated since it has higher precedence than addition. So (++i) +(++i)= (i)+(i)= 7+7=14.
compile and run the program and you will get 14.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / taruna
plzzz explain this ...why can't its answer be 12..???
plzz give proper explaination....waitin!!!
Is This Answer Correct ? | 4 Yes | 7 No |
which typw of errors ? & how to solve it ?
what is meant for variable not found?
what is meant by linking error? how can i solve it? if there is a linking error " unable to open file 'cos.obj'? then what should i do?
what is exceptions?
I am using Qt 5.6 during compilation it stops and gives error about Qmake The process "C:QtQt5.6.35.6.3msvc2015_64inqmake.exe" crashed. Error while building/deploying project untitled1 (kit: Desktop Qt 5.6.3 MSVC2015 64bit) When executing step "qmake"
Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }
wap for bubble sort
what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?
I'm having trouble with coming up with the correct code. Thank You!! The assignment was to write a program using string functions that accepts a price of an item and displays its coded value. The base of the keys: X C O M P U T E R S 0 1 2 3 4 5 6 7 8 9 Sample I/O Dialogue: Enter Price: 489.50 Coded Value: PRS.UX
How to convert hexadecimal to binary using c language..
1 Answers Bajaj, GAIL, Satyam, Zenqa,
what is syntax error?
Write a c-programe that input one number of four digits and find digits sum?