How to create an empty line in C + +
Example
To create an empty line, you need to use double quotation marks.
std::string empty_line = "";
Empty character constant (E0025 in Visual Studio)
It appears when you try to create an empty string but do it with single quotation marks: a character literal must hold exactly one character.
std::string empty_line = '';
empty_line.cpp:3:26: error: empty character constant
You need to replace single quotes with double quotes.
std::string empty_line = "";
The code on this page was run with g++ 15.2.0 on Alpine Linux 3.24.3 (x86_64) in a Docker container.
Article author: Andrei Olegovich