#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}

Answers were Sorted based on User's Feedback



#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / gaurav

5
12

Is This Answer Correct ?    35 Yes 14 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / mayank kumar

i=5
j=11

Is This Answer Correct ?    22 Yes 10 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / tamil selvam

i value is 2.
j value is 7.

Is This Answer Correct ?    19 Yes 9 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / gaurav

Please use gcc compiler....u will get answer 1,i.e. 5 and 12

Is This Answer Correct ?    10 Yes 3 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / rajesh kumar mahto

i=5 and j=11 (100% correct answer)
this is because
j=5+4+2(right to left execution)
i=5 due to latest updation of i.

Is This Answer Correct ?    9 Yes 5 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / kailas.s.patil

i = 2;
first ++i = 3.
second ++i = 4.
third i++ = 5;
now i =5;

then, j = 3 + 4 + 5 = 12

Is This Answer Correct ?    4 Yes 1 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / kapil

i=5
j=11


j=3+4+4; (i++ post increment)
after this step i value become 5(i++)

Is This Answer Correct ?    2 Yes 0 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / sanjay

i = 5
j = 11
It is because during the first pre-increment "++i" the compiler gets the value from the memory, increments it and stores it in the memory ie now i = 3. During the second pre-increment "++i" the compiler again gets the value from the memory, increments it, (value in the memory was 3) and so the incremented value is stored again in memory ie i = 4. during the post increment, the value from the memory is received and used in the statement ie) (the whole final statement looks like this ->>( 3 + 4 + 4) ) and then value of i is incremented and stored in memory. thus finally the value of i is 5 and j is 11.

Is This Answer Correct ?    2 Yes 0 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / 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

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / lebin

value of i is 5
value of j is 12

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More C Interview Questions

Is the C language is the portable language...If yes...Then Why...and if not then what is problem so it is not a Portable language..???

2 Answers   TCS,


what is the use of using linked list and array?

10 Answers   Infosys, TCS,


When the macros gets expanded?

0 Answers  


1.Why do you call C is middle level language? 2.Why do you call C is userfriendly language.

2 Answers  


parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 output: 1 23 456 7891 23456 789123 sample2: enter the size: 5 enter the seed: 3 output: 3 45 678 9123 45678 parkside should not exceed 10 while its seed should only be not more than 9..

4 Answers  






How do you print only part of a string?

0 Answers  


What is switch in c?

0 Answers  


What is the collection of communication lines and routers called?

0 Answers  


What is the meaning of c in c language?

0 Answers  


Explain what math functions are available for integers? For floating point?

0 Answers  


What is huge pointer in c?

0 Answers  


What is the difference between test design and test case design?

0 Answers  


Categories