M.BM has number of items in inventory, and Q.front->BM has number of items user wants. After run this function M.BM should subtract number of items that user wants.
but, after run this function my inventory stays same.
also, when I enqueue ABC and 2, the function nextline() prints ? -8989283
Code:
void nextline()
{
int i;
i = dequeuedata();
printf("%c %i" , name, i);
}
Code:
int dequeuedata()
{
int i;
struct customer * tempPtr;
if(isEmpty(Q))
{
printf("No More Orders\n");
}
strcpy(name, Q.front->firstname);
/* name is a global variable declared as char name[25] */
switch(ch) /* ch is a global variable */
{
case '1':
i= Q.front->BM;
M.BM -= Q.front->BM;
break;
}
tempPtr = Q.front;
Q.front = Q.front->next;
if (Q.front == NULL)
Q.rear = NULL;
free (tempPtr);
return i;
}