Difficulty: Easy
Correct Answer: A variable that stores address of other variable
Explanation:
Introduction / Context:
Pointers are fundamental in C for indirect access, dynamic memory management, and interfacing with arrays and functions. Understanding the precise definition of a pointer prevents misuse and clarifies how memory addresses are manipulated in code.
Given Data / Assumptions:
Concept / Approach:
A pointer is a variable whose value is the address of another object (variable). Declared as type *name, it stores the location of an object of that type. While there are function pointers that hold code addresses, the most accurate, general-purpose definition is that a pointer stores the address of another variable (object). It is not a keyword; it is a kind of variable with a special value (an address).
Step-by-Step Solution:
Identify that a pointer value is an address (e.g., &x).Understand that dereferencing *p accesses the object at that address.Select the option stating it stores the address of another variable.Exclude options that mischaracterize keywords or overgeneralize.
Verification / Alternative check:
Given int x = 10; int *p = &x; *p == 10 evaluates true, confirming that p stores x's address and can access x indirectly.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing the pointer's own address (&p) with the address it stores (p). Also, forgetting to initialize pointers leads to undefined behavior.
Final Answer:
A variable that stores address of other variable.
Discussion & Comments