Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 9 years ago

Really confusing C programming question?

The "cons" function in the program list1.c appears below.

/* return the result of the "consing" an element to the front of the given list */

struct node *cons (char *newCar, struct node *list) {

struct node newNode;

newNode.data = newCar;

newNode.next = list;

return &newNode;

}

Compile list1.c with main.c trace through the code and draw a box-and-pointer diagram of the lsit structure that results from adding two elements to the list. Explain your diagram.

1 Answer

Relevance
  • MT
    Lv 4
    9 years ago
    Favorite Answer

    Really confusing indeed!! As we have no idea what main.c is. :)

Still have questions? Get your answers by asking now.