Explain the concept of Memory allocation in C/C++.
C/C++ uses calloc( ) function to allocate a particular amount of memory area. It comprises of two settings and the resulting length will be the product of its two parameters. Calloc works in C/C++ by filling the memory area with Zeros and then returning a pointer to the first byte. If the calloc() function fails to locate enough space it the CPU, it simply returns the NULL pointer.
The malloc( ) function is also used to allocate the memory area but its length will be the value which has been defined in the parameter. Also, memory initialization does not take place in this function.
The free( ) function is widely used to free the allocated memory once the job is done.
Related Article Facebook Interview Questions
BY Best Interview Question ON 25 Oct 2019