Examveda
Examveda

In C, which operator is used for pointer-to-pointer relationships?

A. *

B. &

C. ->

D. ::

Answer: Option A

Solution(By Examveda Team)

In C, the operator used for pointer-to-pointer relationships is Option A: *. The asterisk () operator is used for both declaring and dereferencing pointer variables. When you have a pointer-to-pointer (a pointer that points to another pointer), you use multiple asterisks to access the value pointed to by the second pointer.

So, the correct answer is:
Option A: *
Here's an example of a pointer-to-pointer relationship in C:
int num = 42;
int *ptr1 = # // Pointer to an integer
int **ptr2 = &ptr1; // Pointer to a pointer to an integer

// Access the value using the pointer-to-pointer
int value = **ptr2; // value is now 42
In this example, ptr2 is a pointer-to-pointer, and **ptr2 is used to access the value stored in num.

This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Related Questions on C Fundamentals