#stack with a linked list inside

4 messages · Page 1 of 1 (latest)

topaz cairn
#

i am having issues trying to figure out how to pass the address of my linked list that is stored inside my stack to a function.

void printreceipts(SNODE **StackTop)
{

if (*StackTop == NULL)
{
  printf("No receipts\n");
}
else 
{
  /* I am supposed to use another function (ReturnAndFreeLinkedListNode(LNODE **, char [])) to traverse the linked list that is stored in my stack. it is also supposed to bring back one 'ticket' from the linked list in the Ticket variable */
  char Ticket[5];
  ReturnAndFreeLinkedListNode(StackTop->(*TicketList), Ticket);
  pop(StackTop);
}

this is my typedef for my Stack,

typedef struct SNODE
{
    int ReceiptNumber;
    char *MovieTheaterName;
    LNODE *TicketList;
    struct SNODE *next_ptr;
} 
SNODE;

I assume the Return function, Ticket variable, and pop function should all be in a while loop, but i am just so stuck..

craggy kestrelBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

topaz cairn
#

^^Forgot to add, the ReturnAnd.. function needs two parameters, one of type LNODE **, and one of type char [].

topaz cairn
#

!solved