Part of my program is to count all the elements on my list. I have no trouble doing this, but it only counts each int once. If there are duplicate elements it skips them. EX. 70 70 50 30 20 20 10 . My program would say there are 5 elements on my list when it should say 7. Here is a copy of this part of my program. Any suggestions would be appreciated. I tried to use a debug statement in my while loop, but i'm a little novice with C. Thank you.
Code:#include "ll.h" int countAll(lnode * h) { int count = 0; while ( (h != NULL )) { count++; h=h->next; } return count; }