g++ c++ error: ‘malloc’ was not declared in this scope

Error: ‘malloc’ was not declared in this scope when using malloc() in c++
1. Handwriting errors.
2. No reference to the appropriate library.
Solution: Introduce stdlib.h

#include<stdlib.h>
guess is that there is a solution, not try: https://blog.csdn.net/u012197749/article/details/79687899

Read More: