#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

Given a string write a program to print all alphabetical characters in the order of their occurance first,followed by the sum of the numeric characters then followed by the special characters in the order of their occurance.

1 Answers   College School Exams Tests, Wipro,


What's wrong with "char *p; *p = malloc(10);"?

5 Answers  


How to find the usage of memory in a c program

1 Answers   Infosys,


Explain the term printf() and scanf() used in c language?

0 Answers  


WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"

3 Answers  






What is the use of a semicolon (;) at the end of every program statement?

1 Answers  


What is conio h in c?

0 Answers  


Write a program to print fibonacci series using recursion?

0 Answers  


what is the meaning of 'c' language

3 Answers  


Explain how can I open a file so that other programs can update it at the same time?

0 Answers  


main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }

4 Answers   CitiGroup,


What is malloc calloc and realloc in c?

0 Answers  


Categories