SE250:lab-4:mcar147
Jump to navigation
Jump to search
Lab 4
I kept wanting to do recursion for all the functions despite being told it is not the most effecient way
The best bit of code I managed to write was the nice simple finding of the nth element of a linked list
element_t nth(int i, Cons* list) {
int cellnumber = 1;
for( ; (list != nil) && (cellnumber < i); list = list->tail ) {
cellnumber ++;
}
return list->head;
}