Practice mode C Language

In C, what is the type of the character constant ‘A’?

Correct answer C. int

Explanation

In C an integer character constant such as 'A' has type int, so sizeof('A') equals sizeof(int), usually 4. This is a well-known difference from C++, where 'A' has type char and sizeof('A') is 1. The value is the character's code, 65 in ASCII, and it is converted to char only when you store it in a char variable.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.