malloc: Parameters: Int, size of memory in bytes Returns: void *, pointer to void , need to be type casted into valid pointer for proper pointer arithmetic. calloc: Parameters: Int, size of each block in bytes, and Int, total number of blocks. Returns: same as malloc Example: int *arr = (int *)malloc(ELEMENT_COUNT * sizeof(int)); Read more : https://www.google.com/amp/s/www.geeksforgeeks.org/dynamic-memory-allocation-in-c-using-malloc-calloc-free-and-realloc/amp/
25th Apr 2020, 1:15 PM
Arvind Singh Rawat
Arvind Singh Rawat - avatar