#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 / manjunath.b.a

i=5
j=12

Is This Answer Correct ?    1 Yes 1 No

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

Answer / vivek patel

it give warning...........

because fun should have return type...

first i=2

then ++i so i=3 and j=3+ ++i + i++
then ++i so i=4 and j=3 + 4 + i++;
then i++ so i=5 and j=3 + 4+ 5;
so i=5 and j=12;

there is no more diff between i++ and ++i in run time..
it gives same ans....

Is This Answer Correct ?    3 Yes 3 No

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

Answer / ashok reddy

intially i=2
j=++i + ++i + i++;
in this statament it calculates from r-l
so j=5+4+2
and the last value of i is 5
so i=5 and j=11
is the correct answer

Is This Answer Correct ?    0 Yes 0 No

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

Answer / barathi

i=2
j=9

Is This Answer Correct ?    0 Yes 0 No

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

Answer / nb

i = 2 (i dont change)
j = 6 (++i = 3 and in i++ increments after calculating j )

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More C Interview Questions

What is the difference between calloc() and realloc()?

1 Answers  


what is a function method?give example?

0 Answers  


How to write a program for swapping two strings without using 3rd variable and without using string functions.

7 Answers   iGate, Infotech,


what is c programing

11 Answers   Wipro,


Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.

2 Answers   Infosys,


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

0 Answers  


What is abstract data structure in c?

0 Answers  


Do you know what are the properties of union in c?

0 Answers  


what does " calloc" do?

7 Answers   Cadence, Logos,


Can a binary search tree be used as an index? If yes, how? Explain

0 Answers   TCS,


What is alloca() and why is its use discouraged?

1 Answers  


How many parameters should a function have?

0 Answers  


Categories