What is the type of string literals in C/ C++?

C++ProgrammingServer Side Programming

The string literals are the set of characters which is enclosed in double quotes(“ “). Wide-string literals are prefixed with L always.

Types of string literals −

Sr.No.String Literals & Description
1“ “
Unprefixed string literal
2L” “
Wide-string literal
3u8” “
UTF-8 encoded string literal
4u” “
UTF-16 encoded string literal
5U” “
UTF-32 encoded string literal
6R” “
Raw string literal

Here is an example of string literal in C++ language,


 Live Demo

#include <cwchar>
#include <cwctype>
#include <iostream>

using namespace std;
int main() {

   wchar_t s[] = L"hello world!";
   wcout << L"The uppercase string : ”" << L"\"is ";

   for (int i = 0; i < wcslen(s); i++)

   return 0;


Here is the output

The uppercase string : ""is HELLO WORLD!
Published on 24-Oct-2018 12:44:11