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.

Computer Science & Information Technology

You might also like to view...

The ___________ Act places restrictions on online organizations in the collection of data from children under the age of 13.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

You can customize the presentation design by changing the background of your slides

Indicate whether the statement is true or false

Computer Science & Information Technology

Asynchronous serial connections are typically used with analog modems.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Using which of the following services could you upload your website files directly from your computer's hard disk to your host's web server?

A. an ISP B. an FTP client C. an operating system D. a CMS

Computer Science & Information Technology