What is the difference between character constant and string literals? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between character constant and string literals?

related to c++

15th Sep 2017, 4:12 PM
Penkiller
Penkiller - avatar
3 Answers
+ 7
A character constant like '!' represents a single character. A string literal between double quotes usually represents multiple characters. A string literal like "!" seems to represent a single character, but it actually contains two: the ! you requested, and the \0 which terminates all strings
15th Sep 2017, 5:11 PM
P R
P R - avatar
15th Sep 2017, 4:18 PM
josh mizzi
josh mizzi - avatar
0
Thank you for helping me
28th Jun 2020, 6:40 AM
Satyabrata Bhattacharya
Satyabrata Bhattacharya - avatar