Beispiel #1
0
int main()
{
    node *h1, *h2;
	 h1 = h2 = NULL;
    push(&h1,5);
    push(&h1,3);
    push(&h1,9);
    
	 push(&h2,6);
    push(&h2,4);
    push(&h2,7);
    
    print_list(h1);
	 print_list(h2);

	 printf("Sum : %d\n",sum_list(h1,h2));
    
    return 0;
}
Beispiel #2
0
/* Average the count elements of the list. */
static inline long average_list(long *list, int count)
{
    long total = sum_list(list, count);
    return total / count;
}
Beispiel #3
0
void test_list(int info[]) {
    int *resultp = &info[0];
    int use_static = info[1];
    list_ptr head = use_static ? static_head : dynamic_head;
    *resultp = sum_list(head);
}