Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void add(queue *q, int x)
- {
- node_pointer temp;
- temp = (queue)malloc(sizeof(struct queuenode));
- temp -> data = x;
- (*q) = temp -> next;
- (*q) = temp;
- if ((*q)==NULL)
- {
- (*q) -> front = temp;
- (*q) -> back = temp;
- }
- else
- {
- (*q) -> back -> next = temp;
- (*q) -> back = temp;
- }
- }
- typedef struct queuenode {
- int data;
- struct queuenode *next;
- } *node_pointer;
- typedef struct endpointer {
- node_pointer front;
- node_pointer back;
- } *queue;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement