In this C++ tutorial, you shall learn how to create an empty string using double quotes notation, with examples.
Create Empty String
To create an empty string in C++ using double quotes, provide the quotes and give no character in the quotes. That returns an empty string.
In the following code snippet, we create an empty string using double quotes.
</>
Copy
string name = "";
Example
In the following program, we create empty strings using double quotes, and print the empty string to console output.
main.cpp
</>
Copy
#include <iostream>
using namespace std;
int main() {
string name = "";
cout << "Name : " << name;
}
Output
Name :
Conclusion
In this C++ Tutorial, we learned how to create an empty string in C++ using double quotes.