In C, which operator is used for pointer-to-pointer relationships?
a) & (ampersand)
b) * (asterisk)
c) -> (arrow)
d) [] (brackets)
Answer:
b) * (asterisk)
Explanation:
In C, the asterisk (*
) operator is used to declare and manipulate pointers, including pointer-to-pointer relationships. A pointer-to-pointer is essentially a pointer that stores the address of another pointer. For example, int **pp
is a pointer to a pointer that points to an integer. The *
operator is used to dereference the pointers and access the values they point to.
Understanding pointer-to-pointer relationships is crucial for working with dynamic memory allocation and complex data structures in C programming.