
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
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
#include<iostream> using namespace std; main() { cout << 'ABCD'; }
Output
1094861636
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.
- Related Articles
- What do the ciliary muscles do when you are focusing on a nearby object?
- How do I add multiple items to a Java ArrayList in single statement?
- Single quotes vs. double quotes in C or C++\n
- Single and Double Quotes in Perl
- How do I insert multiple values in a column with a single MySQL query?
- How to escape single quotes in MySQL?
- Why does the update command in MySQL insist on using slanted single quotes?
- What is the difference between single and double quotes in JavaScript?
- What is the difference between single and double quotes in python?
- Print newline in PHP in single quotes\n
- When fuels burn what do they produce?
- Which MySQL function can be used to append values of a column with single quotes?
- How to do multiple imports in Python?
- What Does cd do on Linux
- What do you think when you are alone?

Advertisements