#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 13 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 ?    21 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

Do pointers store the address of value or the actual value of a variable?

0 Answers   Fidelity,


Write a function to find the area of a triangle whose length of three sides is given

2 Answers  


What is the difference between near, far and huge pointers?

0 Answers  


without using arithmatic operator solve which number is greater??????????

1 Answers   Accenture,


i need all types of question paper releted to "c" and other language.

0 Answers  






What is auto keyword in c?

0 Answers  


Write a code to determine the total number of stops an elevator would take to serve N number of people.

0 Answers   Expedia,


write a program to find the sum of the array elements in c language?

24 Answers   ICT, Infosys, Wipro,


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

0 Answers  


What is indirection? How many levels of pointers can you have?

0 Answers   Aspire, Infogain,


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

0 Answers  


Write a c program to print the even numbers followed by odd numbers in an array without using additional array

1 Answers   Tech Mahindra,


Categories