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);

}

  1. A.

    A

  2. B.

    a

  3. C.

    65

  4. 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.

Explore the full course: Up Lt Grade Assistant Teacher 2025