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() { main(); }

1 Answers  


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }

1 Answers  


main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error

1 Answers   HCL,






main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false

1 Answers   Cognizant, lenovo,


main() { printf("%x",-1<<4); }

3 Answers   HCL, Sokrati, Zoho,


find A^B using Recursive function

2 Answers  


what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }

6 Answers   CSC, IIIT,


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,


How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...

6 Answers   Microsoft, MSD, Oracle,


Categories