# Deque using doubly linked list

I was trying to implement a deque using a singly LL when I realized that eject() (popping the tail element) wasn't going to work without a pointer to the previous element.

A few implementations I've seen online seem to use a node struct as well as a queue struct, so I'm starting to think I might've really messed this thing up (although it somehow seems to work).

I'm only including the 4 main functions; push() pop() inject() and eject().

Any feedback is welcome. A few things on my mind besides optimization issues: how would you test the robustness of something like this? I ran tests "manually" but clearly nothing exhaustive. Also I wanted to return an actual value for pop() and eject() instead of just printing it, but I'm not sure what to do when the list is empty. As of right now I end up returning zero with a message, but that feels...not amazing.

EDIT: This is obviously a lot of code butpop()/eject() and push()/inject() are very similar; so if you don't have time to look at the whole thing, feedback on pop() and push() would already be great, or even just one of them.

typedef struct node{
int value;
struct node* next;
struct node* previous;
}node;

node* tail = NULL;

int tail_value();
void push(int);
int pop();
void inject(int);
int eject();

int size = 0;

void push(int value)
{
{
size++;
}
else
{
node* new_node = malloc(sizeof(node));
new_node->value = value;
new_node->next->previous = new_node;
new_node->previous = NULL;
size++;
}
}

int pop()
{
{
printf("List Empty\n");
return 0;
}

int value = temp->value;
free(temp);
size--;
if (size == 0)
tail = NULL;
return value;
}

void inject(int value)
{
if (tail == NULL)
{
tail = malloc(sizeof(node));
tail->value = value;
tail->next = NULL;
tail->previous = NULL;
size++;
}
else
{
node* new_node = malloc(sizeof(node));
new_node->value = value;
tail->next = new_node;
new_node->previous = tail;
tail = new_node;
new_node->next = NULL;
size++;
}
}

int eject()
{
if (tail == NULL)
{
printf("List Empty\n");
return 0;
}

int value = tail->value;
node* temp = tail;
tail = temp->previous;
free(temp);
if (tail != NULL)
tail->next = NULL;
size--;
if (size == 0)