Fri Oct 21 2016
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
struct node{
int data;
struct node *link;
};

struct node* create(int value){
struct node *new = (struct node*)malloc(sizeof(struct node));
new->data = value;
new->link = NULL;
return new;
}

void insert(struct node *first,int value){ //inserts at the end
struct node *temp = create(value);
while(first->next!=NULL){
first = first->link;
}
first->next = temp;
}

void delete(){ //deletes the first node
struct node *temp;
temp = first;
first = first->next;
free(temp);
}