Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the linked list shown below. Assume that the nodes are in the usual inf

ID: 3691916 • Letter: C

Question

Consider the linked list shown below. Assume that the nodes are in the usual info-link form. If necessary, declare additional variables. (Assume that list, current, temp, trail, and last are pointers of type nodeType.) Make each of the following statements as valid or invalid. If a statement is invalid, explain why. current = list; temp->link->link = nullptr; trail->link =0; d. * temp = last; list = 75; temp->link->info = 75; current -> info = trail->link; * list = * last; current = last; j. coutlink->info;

Explanation / Answer

a) Valid.
b) Valid.
c) Invalid. Because you cannot assign integer to type *nodeType.
d) Invalid. Because you cannot assign *nodeType to nodeType.
e) Invalid. Because you cannot assign integer to type *nodeType.
f) Valid.
g) Invalid. Because you cannot assign *nodeType to integer.
h) Valid.
i) Valid.
j) Invalid. Because trail->link->link is null and trail->link->link->info gives error.