What will be the output of the following? main ( ) { int a = 'A'; printf…
2018
What will be the output of the following?
main ( )
{
int a = 'A';
printf ("%d", a);
}
- A.
A
- B.
a
- C.
65
- D.
Compilation error
Attempted by 842 students.
Show answer & explanation
Correct answer: C
In C, character literals like 'A' are stored as their corresponding ASCII integer values. The ASCII value for uppercase 'A' is 65. When this value is assigned to an integer variable a and printed using the %d format specifier in printf, it outputs the numeric value 65.