Translate the following recursive linked list program into assembly language. Us
ID: 3774983 • Letter: T
Question
Translate the following recursive linked list program into assembly language. Use the examples in fig 6.47
#include <iostream>
using namespace std;
struct node{
node* next;
int data;
};
// Simple insert routine for linked lists
// in: call-by-reference to pointer
// value to insert into the linked list
// out: insert at the top of the linked list
void insert(node*& ptr, int value) {
node* temp = new node;
temp->next = ptr;
temp->data = value;
ptr = temp;
}
int main() {
node* root = NULL;
node* p;
int value;
cin >> value;
while (value >= 0) {
insert(root, value);
cin >> value;
}
for (p = root; p != NULL; p=p->next)
cout << p->data << ' ';
cout << endl;
return 0;
}
Explanation / Answer
Assembly Language code :
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.