Nov 28, 2012 #1 F fly_on_the_nose Newbie level 2 Joined Jun 13, 2012 Messages 2 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,290 Why don´t work right? Please help T* getItem(List *list, int pos) { if(!list || pos < 0 || pos >= list->length) return NULL; int u; ListItem *ha = list->first; for(u = 0; u < pos; u++) { ha = ha->next; if(!ha) return NULL; } return (T*)ha; }
Why don´t work right? Please help T* getItem(List *list, int pos) { if(!list || pos < 0 || pos >= list->length) return NULL; int u; ListItem *ha = list->first; for(u = 0; u < pos; u++) { ha = ha->next; if(!ha) return NULL; } return (T*)ha; }