Search:

Type: Posts; User: hk_mp5kpdw

Search: Search took 0.05 seconds.

  1. Replies
    12
    Views
    2,970

    *n is whatever n points to (it dereferences the n...

    *n is whatever n points to (it dereferences the n pointer), which is in this case a node object/struct. The difference comes when you change the n pointer from a node to something else. In the case...
  2. Replies
    12
    Views
    2,970

    One thing I've noticed, your node creation...

    One thing I've noticed, your node creation function does no checking that the malloc call has succeeded. You can try altering that function a bit:

    node* newNode(int data) { //create a new node
    ...
  3. Replies
    12
    Views
    2,970

    Worked fine (without crashing that is) for me...

    Worked fine (without crashing that is) for me after correcting one item that prevented me from compiling:

    node* newNode(int data) { //create a new node
    node* node = malloc(sizeof(node));
    ...
Results 1 to 3 of 3