Skip to content

Instantly share code, notes, and snippets.

@captainsafia
Created August 17, 2012 20:58
Show Gist options
  • Save captainsafia/3382593 to your computer and use it in GitHub Desktop.
Save captainsafia/3382593 to your computer and use it in GitHub Desktop.
Queue Data Structure in C
#include "queue.h"
void init(int *head, int *tail) {
*head = *tail = 0;
}
void push(int *q,int *tail, int element) {
q[(*tail)++] = element;
}
int pop(int *q,int *head) {
return q[(*head)++];
}
int empty(int head, int tail) {
if (head==tail) {
return 1;
} else {
return 0;
}
}
@biniyam112
Copy link

pretty helpful!...thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment