You need to add:
#include
【C|implicit declaration of function ‘malloc’的解决方法】 This file includes the declaration for the built-in function
malloc
. If you don't do that, the compiler thinks you want to define your own function named malloc
and it warns you because:- You don't explicitly declare it and
- There already is a built-in function by that name which has a different signature than the one that was implicitly declared (when a function is declared implicitly, its return and argument types are assumed to be
int
, which isn't compatible with the built-inmalloc
, which takes asize_t
and returns avoid*
).
推荐阅读
- Linux|109 个实用 shell 脚本
- linux笔记|linux 常用命令汇总(面向面试)
- Linux|Linux--网络基础
- linux|apt update和apt upgrade命令 - 有什么区别()
- c/c++|有感 Visual Studio 2015 RTM 简介 - 八年后回归 Dot Net,终于迎来了 Mvc 时代,盼走了 Web 窗体时代...
- linux|2022年云原生趋势
- C/C++|C/C++ basis 02
- Go|Docker后端部署详解(Go+Nginx)
- 开源生态|GPL、MIT、Apache...开发者如何选择开源协议(一文讲清根本区别)