Linked List を使用していて、where 番目のノードの後にデータ d を持つ新しいノードを挿入しようとしています。何らかの理由で、間違った結果が得られます。これが私のコードです:
void insertAfter(int d, int where )
{
struct list * marker = head;
struct list * new;
while(marker -> data != where)
marker = marker -> next;
new = (struct list*)malloc(sizeof(struct list));
new -> next = marker -> next;
marker -> next = new;
new -> data = d;
}