AP BIOLOGY

THE HUMAN IMMUNE SYSTEM

AIDS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
A
.
B
&
C
*
D
Explanation: 

Detailed explanation-1: -1) In a structure, if a variable works as a pointer then from the given below operators which operator is used for accessing data of the structure using the variable pointer? The correct option is (b). Explanation: For a structure, Arrow (->) is used for access the data using pointer variable and Dot(.)

Detailed explanation-2: -To access members of a structure using pointers, we use the-> operator. In this example, the address of person1 is stored in the personPtr pointer using personPtr = &person1; . Now, you can access the members of person1 using the personPtr pointer.

Detailed explanation-3: -You can access a structure member using pointers, of type structure, in the following ways; 1) Using the arrow operator: If the members of the structure are public then you can directly access them using the arrow operator (-> ).

Detailed explanation-4: -The indirection operator (or dereferencing operator) ( * ) operates on a pointer, and returns the value stored in the address kept in the pointer variable.

Detailed explanation-5: -Explanation: Because arrow operator(->) is used to access members of structure pointer whereas dot operator(.) is used to access normal structure variables.

There is 1 question to complete.