main()

{

int c=- -2;

printf("c=%d",c);

}



main() { int c=- -2; printf("c=%d",c); }..

Answer / susie

Answer :

c=2;

Explanation:

Here unary minus (or negation) operator is used
twice. Same maths rules applies, ie. minus * minus= plus.

Note:

However you cannot give like --2. Because --
operator can only be applied to variables as a decrement
operator (eg., i--). 2 is a constant and not a variable.

Is This Answer Correct ?    18 Yes 9 No

Post New Answer

More C Code Interview Questions

#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }

3 Answers  


Finding a number which was log of base 2

1 Answers   NetApp,


main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

5 Answers   HCL,


Write a single line c expression to delete a,b,c from aabbcc

2 Answers   Microsoft,


#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  






Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.

2 Answers  


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; }

1 Answers  


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }

1 Answers  


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

11 Answers   Google,


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


Categories