I'm having a problem with my search function for my linked list. It has to do with my foodItem object. I'm not sure what to replace it with since it's part of the function protocol. The previous version of this code used an array and part of my problem is correctly converting to a linked list format. I'm really stuck, so any advice would be much appreciated. I hope I didn't leave out anything helpful. :) --Sheila

[COLOR=#008000]*searchByName:search for foods by name[/COLOR]
[COLOR=#008000]*return:true if there is a match, or else false[/COLOR]
[COLOR=#0000ff]bool[/COLOR][COLOR=#000000] FoodList::searchByName([/COLOR][COLOR=#0000ff]char[/COLOR][COLOR=#000000] name[],Food& foodItem)[/COLOR][COLOR=#0000ff]const[/COLOR]
[COLOR=#0000ff]int[/COLOR] i;
size = foodItem.size;
Node * current;
[COLOR=#0000ff]if[/COLOR](foodItem.head == NULL)
head = NULL;
[COLOR=#0000ff]if[/COLOR](strcmp(head->data.name,name) == 0)
head->data.category = foodItem.head->data.category;
head->data.calories = foodItem.head->data.calories;
head->data.carbohydrates = foodItem.head->data.carbohydrates;
head->data.fat = foodItem.head->data.fat;
head->data.cholesterol = foodItem.head->data.cholesterol;
head->data.sodium = foodItem.head->data.sodium;
head->data.protein = foodItem.head->data.protein;
[COLOR=#0000ff]return[/COLOR] [COLOR=#0000ff]true[/COLOR];
[COLOR=#0000ff]return[/COLOR] [COLOR=#0000ff]false[/COLOR];

This thread has a duplicate in the C++ forum. I suggest this one be closed, if a mod would be so inclined. Please don't double-post in the future. ;)

Sorry. I didn't know how to delete this post after i noticed I was in the wrong forum. :)