I have a pointer, nodePtr to a node that is a struct in a linked list. I want to access the member named data. I do this using the expression
a. nodePtr.data
b. nodePtr->data
c. *nodePtr.data
d. (*nodePtr).data
e. data is private, you can’t access data under any circumstances.
b) and d)
Explanation: a) attempts to access a member through a something that is not a class or a struct. nodePtr is pointer, not a struct or class. Part c) gets into precedence trouble. The postfix dot operator binds more closely than the prefix * operator, so we are attempting to access a member in a pointer rather than a struct. Part e) is wrong. The pointer variable nodePtr points to a struct, so access is no problem.
You might also like to view...
After the attacker identifies possible web server, his next step is to enumerate additional details about the server and its components
Indicate whether the statement is true or false.
An organization can use either Social Security Number or Employee ID as the primary key for a table. These two fields are considered ____ keys.
A. primary B. candidate C. alternate D. index