Find cardinal number of a list in C
问题 How can i find only the elements that appears once in the list and return the cardinal number?For example if my list consist of {3,2,1,1,2,4} i expect for return the counter to be 4 and not 6 cause we do not count the duplicate numbers. Here is the code that i have written so far. struct Node { int data; struct Node *next; }; int Find_cardinal(struct Node *start) { struct Node *ptr1, *ptr2 ptr1 = start; int counter=0; /* Pick elements one by one */ while (ptr1 != NULL && ptr1->next != NULL) {