#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}
Answer Posted / vadim g
i=5 and j=12
Here is the sequence of operations:
1. i = 2 => result i = 2
2. first ++i => result: i = 3
3. second ++i => result: i = 4
4. j assignment => result: j = 4 + 4 + 4 = 12
5. i post increment => i = 5
MSVC++ gives 5 and 12.
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
Do you know what are the properties of union in c?
What header files do I need in order to define the standard library functions I use?
What are keywords in c with examples?
How many levels deep can include files be nested?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
What does the c in ctime mean?
What is the explanation for the dangling pointer in c?
Explain how to reverse singly link list.
Why array is used in c?
What are valid signatures for the Main function?
Can an array be an Ivalue?
What is the need of structure in c?
What is typedef struct in c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
Explain modulus operator. What are the restrictions of a modulus operator?