Determine output:
void main(){ int c = - -2; printf("c=%d", c); }

Determine output:

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

In this C program, the expression - -2 involves the use of the unary minus operator (-) applied twice to the number 2.

- The first - operator negates the number 2, resulting in -2.
- The second - operator negates -2, which effectively makes it positive again, resulting in 2.

So, the variable c is assigned the value 2, and the output of the printf statement is c=2, which corresponds to Option C.

Related Questions

Comment on the following 2 C programs.
#include  //Program 1int main(){ int a; int b; int c;}#include  //Program 2int main(){ int a; { int b; } { int c; }}