c++char result11111; 如何初始化
要初始化一个char*变量,可以使用以下方法:
- 使用字符串字面量初始化
例如:
char* result11111 = "Hello World";
- 动态分配内存并初始化
例如:
char* result11111 = new char[100]; strcpy(result11111, "Hello World");
- 初始化为空指针
例如:
char* result11111 = nullptr;
原文地址: https://www.cveoy.top/t/topic/eQ7k 著作权归作者所有。请勿转载和采集!