c++ vector<char>转换成 char*类型

或者能否把字符向量赋值给char*.
2024-12-17 07:56:53
推荐回答(1个)
回答1:

vector a;
……
char* b = &a[0];

注意a的生命周期,当a被析构后再使用b会报错。