Check out example codes for "allocate memory c". It will help you in understanding the concepts better.

Code Example 1

// Use malloc to allocate memory ptr = (castType*) malloc(size); int *exampl = (int*) malloc(sizeof(int)); // Use calloc to allocate and inizialize n contiguous blocks of memory ptr = (castType*) calloc(n, size); char *exampl = (char*) calloc(20, sizeof(char));

Code Example 2

ptr = (castType*)calloc(n, size);

Learn ReactJs, React Native from akashmittal.com