void main()
{
int i=5;
printf("%d",i+++++i);
}
Answer Posted / ashwini
This gives an error. The error is as below:
error C2105: '++' needs l-value
if we correct the code to printf("%d", i++ + ++i);
We get the answer as 12...
The above printf becomes a statement when it sees the
semicolon. Unary operators have right to left associativity.
So, ++i is evaluated first to 6. Then, i++ is evaluated. i++
contributes 6 to addition and then increments i. So, we get
the answer as 12.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Why are all header files not declared in every c program?
i got 75% in all semester am i eligible for your company
What are identifiers c?
Is fortran still used today?
What is the 'named constructor idiom'?
What does sizeof return c?
Explain what is operator promotion?
What is a void pointer in c?
What is the right way to use errno?
What is array of structure in c?
What are the applications of c language?
What is the difference between text and binary i/o?
What is the size of structure pointer in c?
How to explain the final year project as a fresher please answer with sample project
What are the basic data types associated with c?