Question 41
What does 'malloc(10 * sizeof(int))' return if dynamic memory allocation succeeds?
Detailed Solution
malloc returns a void* pointer targeting uninitialized heap memory block.
What does 'malloc(10 * sizeof(int))' return if dynamic memory allocation succeeds?
malloc returns a void* pointer targeting uninitialized heap memory block.
How does 'calloc(n, size)' differ from 'malloc(n * size)'?
calloc allocates memory for n items of given size and zero-fills all bytes.
What is a dangling pointer in C?
A dangling pointer points to invalid/deallocated memory after free() or function stack frame removal.
What is the correct declaration for a function pointer 'fptr' targeting a function taking two ints and returning float?
Parentheses around (*fptr) specify that fptr is a pointer to a function returning float.
Consider 'int **p;'. What does variable 'p' represent?
Double asterisk ** indicates two levels of pointer indirection.