Which operator is used to access the value stored at a pointer address in C?
a) & (ampersand)
b) * (asterisk)
c) -> (arrow)
d) [] (brackets)
Answer:
b) * (asterisk)
Explanation:
The asterisk (*
) operator, also known as the dereference operator, is used in C to access the value stored at a pointer address. For example, if p
is a pointer, *p
will give you the value stored at the memory location that p
points to. This is a fundamental concept in pointer manipulation and is crucial for working with dynamic memory, arrays, and functions that return pointers.
Understanding how to use the *
operator for dereferencing pointers is essential for effective memory management and pointer operations in C programming.