covid_queue.c
//This function pops the first node of the list

This function pops the first node of the list
This function pops the first node of the list
char* dequeue(queue_t *q)
{
    char date[10];
    int cases;
    int deaths;
    char *return_buffer;
    return_buffer = (char*) malloc(sizeof(char) * 30);
	node_t *temp = q->front;
    if(q->front == NULL)
    {
        puts("Queue is empty");
        return NULL;
    }
	q->front = q->front->next;
    if(q->front == NULL)
        q->rear = NULL;
    strcpy(date, temp->date);
    cases = temp->cases;
    deaths = temp->deaths;
    sprintf(return_buffer, "%s %d %d\n", date, cases, deaths);
    free(temp);
    q->size--;
	return return_buffer;
}
char * dequeue ( queue_t * q ) { char date [ 10 ] ; int cases ; int deaths ; char * return_buffer ; return_buffer = ( char * ) malloc ( sizeof ( char ) * 30 ) ; node_t * temp = q -> front ; if ( q -> front == NULL ) { puts ( " " ) ; return NULL ; } q -> front = q -> front -> next ; if ( q -> front == NULL ) q -> rear = NULL ; strcpy ( date , temp -> date ) ; cases = temp -> cases ; deaths = temp -> deaths ; sprintf ( return_buffer , " \n " , date , cases , deaths ) ; free ( temp ) ; q -> size -- ; return return_buffer ; }
This function pops the first node of the list
This function pops the first node of the list
//Check if head reference is NULL
 //This pops the node, most important part
