I learned all that from books, many years ago...
malloc - allocates a block of memory of a requested size.
calloc - allocates multiple contiguous blocks of memory of a requested size.
alloc - alternate name for malloc
realloc - expands or contracts the size of a memory block. If the block cannot be expanded in place, it will copy your data to a new block and return a pointer to that block. If it returns a new location then you must not resuse the old pointer or free it. realloc manages that for you.
memcpy - copies a block of data from one location to another.
memmove - copies a block of data from one location to another. If the regions overlap this function insures that the copy order is correct to prevent data loss.
free - returns a block of memory allocated by malloc, calloc or alloc. This prevents memory leaks.
void * pMemory = malloc(64); void * pMemory = calloc(4, sizeof(MyStruct)); void * pNewMemory = realloc(pOldPointer, 128); memcpy(pNewLoc, pOldLoc, 64); memmove(pNewLoc, pOldLoc, 64);
http://msdn.microsoft.com/en-us/library/634ca0c2%28v=vs.71%29.aspx[
^]
Source code for these functions should be in your Visual Studio install folders.