Difference Between ‘a’ and “a”

Q4. What is the difference between ‘a’ and “a” in C++?

Ans. Characters enclosed in single quotes are character constants in C++. Thus ‘a’ is a character constant.

Characters enclosed in double quotes are string-literals which are array of characters. Thus “a” is a string that is in memory “a” is represented as ”a” where (null) character is the terminator of the string.

The size of ‘a’ is 1 character whereas the size of “a” is 2 characters.


World is full of questions and we are trying to solve a few of them.

Leave a Reply

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