C++之‘malloc’ was not declared in this scope和invalid conversion from ‘void*’ to ‘char*’

1、错误一

'malloc’ was not declared in this scope

2解决

加上头文件文件<stdlib.h>

3、错误二

invalid conversion from 'void*’ to 'char*’ 

4、解决

在malloc函数前面加上强转类型(char *)

(0)

相关推荐