rendered paste body#include <stdio.h>#include <stdlib.h>typedef struct _List List;struct _List { List *next; void *data; };typedef struct { List *head; List *tail; } QUEUE;static inline QUEUE *queue_new (){ QUEUE *q; q = malloc (sizeof (QUEUE)); return (QUEUE *) q;}static inline voidqueue_push (QUEUE *q, void *data) { List *n; n = malloc (sizeof (List)); n->data = data; n->next = NULL; if (q->tail == NULL) { q->head = n; } else { q->tail->next = n; } q->tail = n;}static inline void *queue_pop (QUEUE *q){ List *l; void *ret; if (q->head == NULL) { return NULL; } l = q->head; q->head = q->head->next; if (q->head == NULL) { q->tail = NULL; } ret = l->data; free (l); return ret;}int main (int argc, char **argv){ QUEUE *q; char *s; q = queue_new (); queue_push (q, "sir"); queue_push (q, "gicmo"); queue_push (q, "miguel"); while ((s = queue_pop (q)) != NULL) { printf ("%s\n", s); } printf ("-------\n"); queue_push (q, "apfel"); queue_push (q, "birne"); printf ("%s\n", (char *) queue_pop (q)); queue_push (q, "bannae"); printf ("-------\n"); while ((s = queue_pop (q)) != NULL) { printf ("%s\n", s); } return 0;}