for loop in C: return each processed element -
i have linked list, , want write function go through each node, , return appropriate elements. this:
struct list* returnelements(struct list *head){ (; head != null ; head=head->next){ if (head->field1 == "something") return head; }
and function called returnelements
have somehow catch each returned node, , it.
is somehow possible?
i think easier without function right inside function call returnelements
make new variable , set type struct list*
, traverse list within function , if find node need use something this:
struct list *temp = head; for(; temp != null; temp = temp->next) { if(strcmp(temp->field1, "something") == 0) { //do whatever want node } }
Comments
Post a Comment