Multiple choice technology programming languages

What will be the output of the following code? #include<stdio.h> #include<conio.h> 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 ASCII value of 'a' is 97. When you write -'a', it's the unary minus operator applied to the character constant 'a', which gives -97. This value is stored in a char variable c and printed as %d.

AI explanation

'a' has the ASCII value 97, so -'a' evaluates to -97. That value fits within the signed char range (-128 to 127), so it's stored unchanged, and printing it with %d (after integer promotion preserves its sign) outputs -97.