What header should I include for memcpy and realloc?

AP. picture AP. · Feb 17, 2010 · Viewed 79k times · Source

I am porting a project to the iPhone and it uses realloc and memcpy which are not found. What is the header to include?

It's a project mixing Objective C and C++ and I am starting to be lost.

Thanks in advance for your help!

Answer

GManNickG picture GManNickG · Feb 17, 2010

In C:

#include <string.h> // memcpy
#include <stdlib.h> //realloc

In C++, remove the .h and prefix with a c. In C++, they will be placed in the std namespace, but are also global.