how to use malloc in c with functions and pointers code example Example: allocate memory c ptr = (castType*)calloc(n, size);