String Class

String Variables in C++

String variables are variables used to hold strings.


Syntax
#include <string>
using namespace std;

//can be declared with or without a value
string stringName = "value";

Notes

C++ strings are mutable.

String is a class within the std namespace. The string header file must be included.


Example
#include <string>
using namespace std;

string name = "Anthony";
cout << "Hello, my name is " << name << endl;

See Also
Documentation

string - C++ Reference

Add to Slack

< Destructor   |   Output >

© 2019 SyntaxDB. All Rights Reserved.