195k views
2 votes
We declare a pointer variable *ptr = &var. ptr is equivalent to _____, *ptr is equivalent to _____.

A. Value, Address
B. Address, Value
C. Pointer, Value
D. Value, Pointer

User Svekke
by
7.8k points

1 Answer

5 votes

Final answer:

In the context of pointers in programming, 'ptr' is equivalent to the address, and '*ptr' is equivalent to the value of the variable it points to. Thus, the correct answer is B. Address, Value.

Step-by-step explanation:

When we declare a pointer variable with the syntax *ptr = &var, the pointer itself, ptr, is equivalent to the address of the variable it points to (in this case, &var). On the other hand, the expression *ptr, which is known as dereferencing the pointer, is equivalent to the value that is stored at the memory location that the pointer is pointing to. Therefore, ptr is equivalent to the address of var, and *ptr is equivalent to the value of var.

The correct answer

The correct answer to the question is B. Address, Value. That is, ptr equates to the address where the variable var is stored, while *ptr equates to the actual value that is stored within var.

User ThatsRightJack
by
8.1k points