Calloc malloc and realloc are use for dynamic memory allocation. Mainly there are two types calloc and malloc. Realloc is the provide the litter variation in malloc.
calloc take two argument i.e. calloc(m,n) where first argument is how much space you require in term of number of elements and 2nd argument is space in term of size of each element
For example
calloc(1000,sizeof(int));
where 1000 is total space that is allocated from heap and it is of size integer.
The main benefit of doing memory allocation through calloc that memory is automatically initialized with 0.
malloc take one argument i.e. malloc(n) wher n is number of bytes required.
For example
malloc(1000*(sizeof(int)));
Where again 1000 require space that is allocated from heap and it is multiplied with integer.
If a pointer has already been allocated memory using malloc and later this allocated memory needs to be expanded for some reason, the realloc function is used. It will add the consecutive memory spaces to the existing if available, otherwise it will allocate whole new space for the same pointer. free is use to de-allocation the memory which we allocation for our use.
As I already told you that alloc malloc and realloc are use for dynamic memory allocation once you allocation memory using any of the method, you must use free to de-allocate the memory.
Yes you are right these function are from C but C++ also support these functions.