What do single quotes do in C++ when used on multiple characters?

In C++ th

In C++ the double quotes are used as string literals, and single quote with one character is used as character literals. Now here we will see what will be the output if we try to print a multi-character string using the single quote.

Example Code

 Live Demo

using namespace std;
main() {
   cout << 'ABCD';



This program returns a large number as output. Now the question is what is the significance of this number?

This number is not some memory address. It is generated from the ASCII values of those characters. In this example we have used A, B, C, D. In Hex the ASCII values of them are 41, 42, 43 and 44. So if we place the number one after another, then the hex code will be like 41424344. Now after converting this into decimal, it will return 1094861636.