access struct member error
if i have this
Code:
void ll_print(llnode **head){ Code:
struct llitem{ llist.c:13: error: request for member ‘next’ in something not a structure or union llist.c:14: error: request for member ‘item’ in something not a structure or union and how do would i go about accessing next or item? |
*head is a pointer to a structure, so you gotta use the arrow, (*head)->next
|
llnode **head
Are you sure that's what you meant (instead of llnode *head)? By the way: head->next is short for (*head).next (and better readable). Edit: Code:
while((*head).next!=NULL) |
my problem was i needed (**head) in those two lines. i know the -> notation is better, i just have always used (*bla).
bad habbit... thanks |
Code:
while((*head).next!=NULL) Code:
while((*head)->next) I'm bad. Got to admit it I didn't read the other posts before this. :) |
All times are GMT -5. The time now is 05:09 PM. |