11 Decide whether the syntax of each of the following statem
11. Decide whether the syntax of each of the following statements is valid or invalid, if it is valid, mark it OK; if it is invalid, explain what is wrong. a. listData->next = ptr1->next; b. listData->next =*(ptr2->next); c. *listData = ptr2; d. ptr2 = ptr1->next->info; e. ptr1->info = ptr2->info; f. ptr2 = ptr2->next->next;
Solution
Serial#
Statement
Valid/Invalid
Reason
a.
listData->next = ptr1->next;
VALID.
RHS and LHS both are both NodePointers.
b.
listData->next =*(ptr2->next);
INVALID.
Cannot assign LinkNode to NodePointer.
c.
*listData = ptr2;
INVALID.
Cannot assign a NodePointer to a LinkNode.
d.
ptr2 = ptr1->next->info;
INVALID.
Cannot assign integer to a NodePointer.
e.
ptr1->info = ptr2->info;
VALID.
RHS and LHS both are both integers.
f
ptr2 = ptr2->next->next;
VALID
RHS and LHS both are both NodePointers.
| Serial# | Statement | Valid/Invalid | Reason |
| a. | listData->next = ptr1->next; | VALID. | RHS and LHS both are both NodePointers. |
| b. | listData->next =*(ptr2->next); | INVALID. | Cannot assign LinkNode to NodePointer. |
| c. | *listData = ptr2; | INVALID. | Cannot assign a NodePointer to a LinkNode. |
| d. | ptr2 = ptr1->next->info; | INVALID. | Cannot assign integer to a NodePointer. |
| e. | ptr1->info = ptr2->info; | VALID. | RHS and LHS both are both integers. |
| f | ptr2 = ptr2->next->next; | VALID | RHS and LHS both are both NodePointers. |

