I have a program that is looking for a total numbers and what is the middle number in a linked list. The question that I have is why it doesn't print out the values?
Here is the code:
int count(list values){
if(values == NULL)
return 0;
else
return 1 + count(values->next);
}
void middle(struct node *head){
int count = 0;
struct node *mid = head;
while (head != NULL){
if(count & 1)
mid = mid->next;
count++;
head = head->next;
}
}
void traverse(list values){
if(values->next)
printf("\n# of the values: %.1f% \nMiddle: %.1f%\n", count, middle);
}
int main(int argc, char *argv[]){
FILE *input = stdin;
list values = readNumbers(input);
traverse(values);
return 0;
}