What is the name of the header file that contains the declaration of the malloc()
function in C and C++?
Asked
Active
Viewed 6.7k times
1 Answers
56
It's in stdlib.h
(C) and cstdlib
(C++).
In general, for such questions, just try to look on google: "c++ function". Most often the first hit will point to cplusplus.com for me containing a complete reference to the standard stuff.

Mario
- 35,726
- 5
- 62
- 78
-
6cplusplus.com is not a very good reference. It contains subtle but important errors in descriptions of many functions in the C standard. No idea how accurate it is for C++ stuff. – R.. GitHub STOP HELPING ICE Sep 03 '11 at 13:09
-
Haven't had any real issues yet (ignoring cross platform differences). – Mario Sep 03 '11 at 15:53
-
One example that comes to mind is its documentation of what `scanf` returns. – R.. GitHub STOP HELPING ICE Sep 03 '11 at 16:13
-
1This has now, ironically, become one of the top google results for this search. – Zimri Leisher Mar 13 '22 at 20:45
-
2@ZimriLeisher Psst! Recursion at work! – Mario Mar 15 '22 at 17:57