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

Develop a routine to reflect an object about an arbitrarily selected plane

0 Answers  


main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

1 Answers  


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,


main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }

1 Answers  






#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }

1 Answers  


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

3 Answers  


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


what is the code of the output of print the 10 fibonacci number series

2 Answers  


how to concatenate the two strings

1 Answers  


how can u draw a rectangle in C

53 Answers   Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


Categories