Multiple choice technology programming languages

What will be output if you will Execute following code? #include #include void main() {     char c=-'a';     printf("%d",c); }

  1. 65

  2. -65

  3. 97

  4. -97

  5. CompilationError

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The character 'a' has ASCII value 97. The unary minus operator makes it -97. When assigned to char c and printed with %d, the integer value -97 is displayed.

AI explanation

'a' has the ASCII value 97, so -'a' is -97. Since -97 fits within the range of a signed char (-128 to 127), it's stored as-is; when passed to printf with %d, it undergoes integer promotion but keeps its signed value, printing -97.