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

main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


Display the time of the system and display the right time of the other country

1 Answers  


How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)

4 Answers   HCL,


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

1 Answers   CSC,


write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,






Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


Who could write how to find a prime number in dynamic array?

1 Answers  


hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


program to find magic aquare using array

4 Answers   HCL,


1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.

8 Answers   IBPS, Infosys, TCS,


enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

2 Answers  


main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

1 Answers  


Categories