defining a string c++ code example
Example 1: string in cpp
// Include the string library
#include <string>
// Create a string variable
string greeting = "Hello";
Example 2: declaring strings c++
std::string str = "hello world";
char *str = "hello world";
char str[] = "hello world";
char str[11] = "hello world";