Skip to content
Sign in
Computer

What is the correct syntax to access the value at address ptr in C, where ptr is a pointer?

Tap an option to check the answer. You can also press A–D.

Show answer

Correct answer: B) *ptr

In C, the asterisk (*) symbol is used to dereference a pointer. It means to access the value stored at the address held by the pointer. Therefore, *ptr is the correct syntax to access the value at the address ptr.
Explanation
In C, the asterisk (*) symbol is used to dereference a pointer. It means to access the value stored at the address held by the pointer. Therefore, *ptr is the correct syntax to access the value at the address ptr.