Difficulty: Easy
Correct Answer: scr is a pointer to char.
Explanation:
Introduction / Context:
This item tests basic pointer declarations in C. The expression char *name; is one of the most common idioms and denotes a pointer that can reference a character or the first element of a character array representing a C string.
Given Data / Assumptions:
Concept / Approach:
In C, the * binds to the identifier as part of the declarator, so char *scr; defines scr as “pointer to char”. This pointer can hold the address of a single char object or the first element of a char buffer that is terminated with '\\0' to represent a string. The declaration does not allocate storage for characters; it only allocates space for the pointer itself.
Step-by-Step Solution:
Verification / Alternative check:
sizeof(scr) equals the size of a pointer on the platform, not the size of a character buffer. Dereferencing *scr yields type char, which confirms the one-level indirection.
Why Other Options Are Wrong:
Pointer to pointer — Would require char **scr.
Function pointer — No function declarator () exists.
Member of function pointer — Not meaningful terminology in C type system.
Common Pitfalls:
Final Answer:
scr is a pointer to char.
Discussion & Comments