*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...
Type: Posts; User: hk_mp5kpdw
*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...
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
...
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));
...