Function to search into a linked list
Posted on 2004-11-15
Hi all, I tried making a function that search a struct into a linked list and return and return the correct struct if founded.
PtrModel Search (PtrModel list, int val, PtrModel* previous)
*previous = NULL;
while (list && list->modelName != val)
list = list->next;
However, it doesn't seems to work. If anyone knows what's wrong, any help would be appreciate. Also, if I wanted to get an int as the returned value, would I only have to change the return value ?
Thanks for your help.