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
If the size of int data type is two bytes, what is the range of signed int data type?
What is sorting in c plus plus?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
How can I call a function with an argument list built up at run time?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
State two uses of pointers in C?
What are pragmas and what are they good for?
What are the different properties of variable number of arguments?
What does calloc stand for?
What is string in c language?
a program that can input number of records and can view it again the record
Is it possible to pass an entire structure to functions?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What are predefined functions in c?
When should you not use a type cast?