I am having problems with this code. I am new to C, and as far as I can tell, I am using the malloc operation correctly.
#include "fifo.h"
I cannot perform this operation without receiving a segmentation error:
queue->tail->next = temp;
I canβt come up with a solution or work not to use this line of code. Can someone explain why this line of code is not working? Thanks in advance.
In addition, the fifo and fifo_element structure are presented here:
struct fifo_element { int customerId; fifo_element *next; fifo_element *prev; }; struct fifo { fifo_element *head; fifo_element *tail; };
and here is my call when Enqueuing:
Enqueue( &f, i ); //f is of type fifo
source share