The answer is correct because it accurately captures the fundamental distinction between these two memory allocation functions in C. malloc() allocates a block of uninitialized memory and requires only the total number of bytes as a single argument, while calloc() allocates memory for an array of elements, takes two arguments (number of elements and size per element), and crucially initializes all allocated memory to zero. This initialization feature of calloc() is a key advantage when you need guaranteed zero values, whereas malloc() leaves memory with whatever garbage values were previously there. Other options would be incorrect if they claimed malloc() initializes memory, if they stated calloc() takes only one argument, or if they reversed which function initializes to zero.
int main() {
int x = 5;
int *p = &x;
int **q = &p;
printf("%d", **q + 1);
return 0;
}
The correct answer is 6 because q is a pointer to pointer that points to p, which points to x. When we dereference q, we get the value of x (which is 5), and then adding 1 gives us 6, which is printed. The key concept here is understanding pointer dereferencing: a single asterisk dereferences one level, so double asterisks dereference two levels, bringing us from q to p to the actual value stored in x. Any other answer would be incorrect because it would either misunderstand the double dereferencing operation or incorrectly interpret what value is being accessed—for instance, if someone only dereferenced once or forgot to add 1, they would get a different result.