39. Insert the following C code fragment in main() of Figure 6.48 just before the return statement:...

Question:

39. Insert the following C code fragment in main() of Figure 6.48 just before the return statement:

first2 = 0; p2 = 0;

for (p = first; p != 0; p = p->next) {

p2 = first2;

first2 = (struct node *) malloc(sizeof (struct node));

first2->data = p->data;

first2->next = p2;

}f or (p2 = first2; p2 != 0; p2 = p2->next) {

printf("%d ", p2->data);

}

printf("");

Declare first2 and p2 to be local variables along with the other locals as follows:

struct node *first, *p, *first2, *p2;

int value;

Translate the complete program to Pep/9 assembly language. The added code creates a copy of the first list in reverse order and outputs it.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Systems

ISBN: 9781284079630

5th Edition

Authors: J Stanley Warford

Question Posted: