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. Related Questions on C Fundamentals
What is the primary purpose of a function prototype in C?
A. Declare a variable
B. Declare a function
C. Define a function
D. Assign a value
What is the correct syntax for declaring a variable in C?
A. int variable_name;
B. variable_name = 5;
C. variable_name int;
D. int = variable_name;
Join The Discussion