C Programming · Question 3 · Easy

What will be the output of the following C program?

#include <stdio.h>

int main(void) {
    char c = 'A' + 2;
    printf("%c %d", c, c);
    return 0;
}
  1. C 67
  2. C 65
  3. A 67
  4. B 66
Answer and explanation

Answer: A. C 67

Explanation: 'A' has ASCII code 65, so c holds 67, which is 'C'. %c prints the character and %d prints its code 67.

Previous: What will be the output of the following C program? · Next: What will be the output of the following C program?

Practise c programming

Try a fresh set of c programming questions with an explanation after every answer, free and without signing up: C Programming practice. Or sit a full placement mock test.

More c programming questions

More technical & programming practice

Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge