/* lqmain.c */ /* this program shoul dwork as expected */ #include #include "lqueue.h" int main() { Queue *qh; int i; int a[] = { 5, 1, 10, 6, 9, 100, 1, 2, 7, 8, 3, 4, -1 }; int n=0; qh = qCreate(); for(n=0; a[n] >= 0; n++) { qEnq(qh, a[n]); printf("%d\t", a[n]); qPrint(qh); } printf("\n"); for (i=0; i<=n; i++) { Node *node; node = qHead(qh); if(node) { printf("%d\t", node->value); qDelete(qh, node); } qPrint(qh); } qDestroy(qh); printf("done.\n"); return 0; }