main()

{

int i=-1;

-i;

printf("i = %d, -i = %d \n",i,-i);

}



main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }..

Answer / susie

Answer :

i = -1, -i = 1

Explanation:

-i is executed and this execution doesn't affect the value
of i. In printf first you just print the value of i. After
that the value of the expression -i = -(-1) is printed.

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C Code Interview Questions

write a c-program to display the time using FOR loop

3 Answers   HCL,


What is the output of the program given below main() { signed char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

1 Answers  


main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  


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

1 Answers  


void main() { char ch; for(ch=0;ch<=127;ch++) printf(ā€œ%c %d \nā€œ, ch, ch); }

1 Answers  






main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

1 Answers  


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


Write a program to print a square of size 5 by using the character S.

6 Answers   Microsoft,


How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com

11 Answers   Deshaw, Infosys,


main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers   CSC,


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


main() { show(); } void show() { printf("I'm the greatest"); }

2 Answers  


Categories