why is printf("%d %d %d",i++,--i,i--);

Answers were Sorted based on User's Feedback



why is printf("%d %d %d",i++,--i,i--);..

Answer / bintu

-1 0 1

Is This Answer Correct ?    7 Yes 4 No

why is printf("%d %d %d",i++,--i,i--);..

Answer / rick g

if: i = (-1)

-1, -1, -1

(1) Print '-1', then post-increment i. i is now 0.
(2) Pre-decrement i. i is now back to -1. Print '-1'
(3) Print '-1', then post-decrement i. i is now -2

Is This Answer Correct ?    2 Yes 0 No

why is printf("%d %d %d",i++,--i,i--);..

Answer / kumar harsh

if i=-1
-3 -3 -1

Is This Answer Correct ?    2 Yes 1 No

why is printf("%d %d %d",i++,--i,i--);..

Answer / faizvvrs14311

if i=-1
-2,-3,-2

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped

1 Answers   IBM,


There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }

1 Answers  


How to count a sum, when the numbers are read from stdin and stored into a structure?

1 Answers  


How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,






Write a routine to implement the polymarker function

0 Answers   TCS,


program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

1 Answers  


why nlogn is the lower limit of any sort algorithm?

0 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


Categories