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

main() { int i=5; printf(“%d”,i=++i ==6); }

1 Answers  


Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


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  






char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

2 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,


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


source code for delete data in array for c

1 Answers   TCS,


void main() { int const * p=5; printf("%d",++(*p)); }

3 Answers   Infosys, Made Easy, State Bank Of India SBI,


Categories