of memory of specified size and returns pointer of type void this means that we can assign it to any type of pointer the general syntax of malloc(is ptr =(cast-type*)malloc(byte-size)where ptr is pointer of type cast-type malloc(returns pointer (of cast typeto an area of memory with size byte-size for examplearr=(int*)malloc( *sizeof(int))this statement is used to dynamically allocate memory equivalent to times the area of int bytes on successful execution of the statement the space is reserved and the address of the first byte of memory allocated is assigned to the pointer arr of type int programming tip calloc(function is another function that reserves memory at the run time it is normally used to request multiple blocks of storage each to use dynamic memory allocation functionsyou must of the same size and then sets all bytes to zero calloc(stands for include the header file stdlib contiguous memory allocation and is primarily used to allocate memory for arrays the syntax of calloc(can be given asptr=(cast-type*calloc( ,elem-size)the above statement allocates contiguous space for blocks each of size elem-size bytes the only difference between malloc(and calloc(is that when we use calloc()all bytes are initialized to zero calloc(returns pointer to the first byte of the allocated region when we allocate memory using malloc(or calloc() null pointer will be returned if there is not enough space in the system to allocate null pointerpoints definitely nowhere it is not pointer markerthereforeit is not pointer you can use thuswhenever you allocate memory using malloc(or calloc()you must check the returned pointer before using it if the program receives null pointerit should at the very least print an error message and exitor perhaps figure out some way of proceeding without the memory it asked for but in any casethe program cannot go on to use the null pointer it got back from malloc()/calloc( call to mallocwith an error checktypically looks something like thisint *ip malloc( sizeof(int))if(ip =nullprintf("\ memory could not be allocated")returnwrite program to read and display values of an integer array allocate space dynamically for the array #include #include int main(int inint *arrprintf("\ enter the number of elements ")scanf("% "& )arr (int *)malloc( sizeof(int))if(arr =nullprintf(\ memory allocation failed")exit( )