C Programming :: Dynamic Memory Allocation - Discussion
15 / 18
x = malloc (y).
x = malloc (y).
Ax is the size of the memory allocated
By points to the memory allocated
Cx points to the memory allocated
DNone of the above
Show Explanation
The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc(), or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.
Asked In ::
malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().
The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc(), or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.
Read Full Answer
Report Error
Please Login First Click Here