How do I calculate and return the value of pointer to max element?

I'm Having extreme difficulties with this question. Here is what i have coded, but it wont work. These are the instructions. TO DO: Insert code here to calculate and return value of pointer to max element (first one if ties.)

Node * pointerToMax(LinkedList *list) {
assert(list!=NULL);
assert(list->head != NULL);

Node *max = list->head;

for (list->head=list->head; list!=NULL; list->head=list->head->next){
if (list->head->next > max){
max = list->head->next;
}
}
return max;
}
Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well as proper indentation.

What do you mean by "won't work"? Does it set your computer on fire? Does it disconnect you from the internet? Does it change your religious beliefs? You need to be specific.
Topic archived. No new replies allowed.