作用:表示一串字符
有2种使用方法:
1、C风格字符串:char 变量名[ ] = “字符串值”
2、C++风格字符串:string 变量名 = “字符串值”
示例
#include <iostream>
using namespace std;
int main() {
//1、C风格字符串
char str[] = "hello world";
cout << str << endl;
//2、C++风格字符串
string str2 = "hello world 2";
cout << str2 << endl;
}


被折叠的 条评论
为什么被折叠?



