int main (){ List *l = createList(); prependList(l, 1); prependList(l, 213); prependList(l, 46); prependList(l, 75); prependList(l, 23); printf("forEach with printInt: \n"); forEach(l, &printInt); printf("\n"); /*forEach with printDouble produces an error with type mismatch*/ /* printf("forEach with printDouble: \n"); forEach(l, &printDouble); printf("\n"); */ printf("printList: \n"); printList(l); destroy(&l); return EXIT_SUCCESS; } /*main*/
ParameterNode* createParameterList(int num, TypeDescriptor* parametersType[], char* nameOfParas[]){ /* TypeDescriptor pointer array, every pointer points to one type*/ ParameterNode* list = NULL; int i; for(i=num-1; i>=0; i--){ ParameterNode* newNode = createParameterNode(parametersType[i], nameOfParas[i]); list = prependList(newNode, list); } return list; }
int main() { List * list = createList(); uintptr_t i; for (i = 0; i < 100; i++) { prependList(list, (void *)i); } iterateList(list, printList); freeList(list); return 0; }