Problem

Show what is produced by the following C++ code. Assume the node is in the usual info-link...

Show what is produced by the following C++ code. Assume the node is in the usual info-link form with the info of type int. (list and ptr are pointers of type nodeType.)

a.

list = new nodeType;list->info = 10;ptr = new nodeType;ptr->info = 13;ptr->link = NULL;list->link = ptr;ptr = new nodeType;ptr->info = 18;ptr->link = list->link;list->link = ptr;cout ≪ list->info ≪ " " ≪ ptr->info ≪ " ";ptr = ptr->link;cout ≪ ptr->info ≪ end1;

b.

list = new nodeType;list->info = 20;ptr = new nodeType;ptr->info = 28;ptr->link = NULL;list->link = ptr;ptr = new nodeType;ptr->info = 30;ptr->link = list;list = ptr;ptr = new nodeType;ptr->info = 42;ptr->link = list->link;list->link = ptr;ptr = List;while (ptr != NULL){cout ≪ ptr->info ≪ end1; ptr = ptr->link;}

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 5
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT