ramytamer

Untitled

May 10th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. void add_in_back(Queue *q, int x){
  2.     node *p = (node*) malloc(sizeof(node));
  3.         p->data = x;
  4.         p->next = NULL;
  5.     if (!isempty(q)){
  6.         p->pre = q->tail;
  7.        (q->tail)->next=p;
  8.     }else{
  9.         p->pre = NULL;
  10.         q->head=p;
  11.     }
  12.     q->tail = p;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment