Using single versus double pointers in Linked lists implemented in C
问题 I was writing this code for adding element at the end of linked list: struct node{ int info; struct node* link; }; void append ( struct node **q, int num ) { struct node *temp, *r ; if ( *q == NULL ) // if the list is empty, create first node { temp = (struct node*) malloc ( sizeof ( struct node ) ) ; temp -> info = num ; temp -> link = NULL ; *q = temp ; } else{ temp = *q ; /* go to last node */ while ( temp -> link != NULL ) temp = temp -> link ; /* add node at the end */ r = (struct node *