Difficulty: Easy
Correct Answer: cmp is a function that return a void pointer.
Explanation:
Introduction / Context:
Distinguishing between “function returning pointer” and “pointer to function” is central to reading C declarations. Here, void *cmp(); uses the function declarator directly on the identifier, with a pointer type as the function's return type. This pattern is common for factory functions that return untyped memory or opaque handles.
Given Data / Assumptions:
Concept / Approach:
Because () applies to the identifier cmp (no parentheses around *cmp), cmp is a function, not a pointer variable. The leading void* indicates that the function returns a pointer to void. Therefore the accurate English reading is “cmp is a function that returns a void pointer”.
Step-by-Step Solution:
Verification / Alternative check:
Compare against a pointer-to-function form: void (*cmp)(); would be a pointer to a function returning void, which is different. Typedefs can help: typedef void* anyptr; anyptr cmp(void); reads clearly and confirms the meaning.
Why Other Options Are Wrong:
Pointer to a void type — Incorrect; that would be void *p; and not a function declaration.
Void type pointer variable — Misstates the form; cmp is declared as a function, not a variable.
Returns nothing — That would be return type void, not void*.
Common Pitfalls:
Final Answer:
cmp is a function that return a void pointer.
Discussion & Comments