hi there i am trying to build a linked list from read a file operation. this code only adds the first node to the list. the problem is i am facing with "error: request for member 'head' in something not a structure or union" error.
Which line is it complaining about?
I noticed this: new_stu->fn_next = (list)->head;
is the only line where you don't dereference list
--shouldn't it be new_stu->fn_next = *(list)->head;
like all the others?
Also, your code seems to be a bit confused. If you're building a linked list with next
fields in each structure, there's no need for LIST** list
. All you should need is LIST* list
; the next
field in each structure will point to the rest of the list.