Lab Program 9 Vtu Code
Lab Program 9 Vtu Code
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
struct node
{
int coef;
int xexp, yexp, zexp;
struct node * link;
};
typedef struct node * NODE;
NODE getnode()
{
NODE x;
x = (NODE) malloc(sizeof(struct node));
if (x == NULL)
{
printf("Running out of memory \n");
return NULL;
}
return x;
}
NODE attach(int coef, int xexp, int yexp, int zexp, NODE head)
{
NODE temp, cur;
temp = getnode();
temp -> coef = coef;
temp -> xexp = xexp;
temp -> yexp = yexp;
temp -> zexp = zexp;
cur = head -> link;
while (cur -> link != head)
{
cur = cur -> link;
}
cur -> link = temp;
temp -> link = head;
return head;
}
void main()
{
NODE head, head1, head2, head3;
int res, ch;
head = getnode();
head -> link = head;
OUTPUT