1、错误一

 

‘malloc’ was not declared in this scope

 

 

 

2解决

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

 

3、错误二

 

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

 

 

 

 

 

4、解决

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