Google News
logo
CPP - Interview Questions
How to use string in C++?
A string is a sequence of characters. In C++, string is a data type as well as a header file. This header file consists of powerful functions of string manipulation. A variable of string is declared as follows :
string str= "Hello"; 
 
And to use string one needs to include the header file.
// Include the string library
#include <string>
 
// Create a string variable
string str= "Hello";​
Advertisement