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 typeCard. 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.
You might also like to view...
Fiber-optic cable is not susceptible to data emanations
Indicate whether the statement is true or false
SomeClass someObject = new SomeClass (some parameters); is an example of ____.
A. assignment B. instantiation C. byte code D. interpretation
Multi-Protocol Label Switching (MPLS) allows for faster, cheaper IP routers based on Ethernet technology.
Answer the following statement true (T) or false (F)
Which of the following is not a valid lookup function?
A. HLOOKUP B. VLOOKUP C. LLOOKUP D. LOOKUP