#include <iostream>
#include <cstdlib>
using namespace std;
struct Node {
float data;
struct Node *next;
};
struct Node* head = NULL;
void insert(float new_data) {
struct Node* new_node = (struct Node*) malloc(sizeof(struct Node));
new_node->data = new_data;
new_node->next = head;
head = new_node;
}
void output() {
struct Node* ptr;
ptr = head;
while (ptr != NULL) {
cout<< ptr->data <<" "<<"\n";
ptr = ptr->next;
}
}
int main() {
insert(76.89);
insert(1);
cout<<"Here is the link list created \n";
output();
cout<<"Roy ";
}
Comments
Leave a comment