Find the error in each of the following:

a) Assume that struct Card has been defined as containing two pointers to type char—namely, face and suit. Also, the variable c has been declared to be of type Card, and the variable cPtr has been declared to be of type pointer to Card. Variable cPtr has been assigned the address of c.
cout << *cPtr.face << endl;
b) Assume that struct Card has been defined as containing two pointers to type char—namely, face and suit. Also, the array hearts[ 13 ] has been declared to be of type Card. The following statement should print the member face of element 10 of the array.
cout << hearts.face << endl;
c) ```
struct Person
{
char lastName[ 15 ];
char firstName[ 15 ];
int age;
} // end struct Person
```
d) Assume that variable p has been declared as type Person and that variable c has been declared as type Card.
p = c;

a) Error: The parentheses that should enclose *cPtr have been omitted, causing the order of evaluation of the expression to be incorrect.
b) Error: The array subscript has been omitted. The expression should be
hearts[ 10 ].face.
c) Error: A semicolon is required to end a structure definition.
d) Error: Variables of different structure types cannot be assigned to one another.

Computer Science & Information Technology

You might also like to view...

?In the context of HTML audio and video element attributes, the _____ attribute's type includesauto,none, andmetadata.

A. ?autoplay B. ?muted C. ?preload D. ?loop

Computer Science & Information Technology

The _________________________ is a TCP/IP service that converts a computer or domain name to an IP address or that converts an IP address to a computer or domain name.

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

Computer Science & Information Technology