Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有代码,它返回 char* 如果在 cpp 中写入:
char* test_char = new char[size];
一切都很好,但是如果我在标题中写:
char* test_char;
在cpp中:
test_char = new char[size];
程序编译但不运行。
我究竟做错了什么?
字符 = 新字符 [大小];
你可能想要
char = new char[size];
这甚至不应该编译。您缺少变量名称: