3 void *malloc(unsigned);
5 // Test opaque structure support. the list type is defined later
8 struct list *PassThroughList(struct list *L) {
13 // Recursive data structure tests...
23 static int Foo = 0; // Test static local variable
24 Foo += 1; // Increment static variable
26 Data = (list*)malloc(12); // This is not a proper list allocation
29 extern list ListNode1;
30 list ListNode3 = { 4, 0 };
31 list ListNode2 = { 3, &ListNode3 };
32 list ListNode0 = { 1, &ListNode1 };
33 list ListNode1 = { 2, &ListNode2 };
38 // Iterative insert fn
39 void InsertIntoListTail(list **L, int Data) {
42 *L = (list*)malloc(sizeof(list));
47 // Recursive list search fn
48 list *FindData(list *L, int Data) {
50 if (L->Data == Data) return L;
51 return FindData(L->Next, Data);
59 InsertIntoListTail(&MyList, 100);
60 InsertIntoListTail(&MyList, 12);
61 InsertIntoListTail(&MyList, 42);
62 InsertIntoListTail(&MyList, 1123);
63 InsertIntoListTail(&MyList, 1213);
65 if (FindData(MyList, 75)) foundIt();
66 if (FindData(MyList, 42)) foundIt();
67 if (FindData(MyList, 700)) foundIt();