I am dealing with linked lists, and am having issues moving to the next element of the Linked List. the error that I get is:
error: incompatible types when assigning to type 'item' from type 'struct item *
typedef struct item
struct item *next;
item head, curr, tail;
head.next = (item*) malloc(sizeof(item));
curr = head.next;
Based in your description, you want to make
curr the next node of the linked list (?).
In that case, you should assign the memory direction of
head.next. How, you may ask ?:
item head, curr; // declaration of variables head.size = 8; curr.size = 5; head.next = &curr; // making 'curr' the next node
Now, in the memory you will have something like this (memory addresses are just arbitraries numbers):
NOTE: Pointers keep memory addresses. That's why you assign them the return value of
malloc(), which give the memory direction of an available "memory chunk" with the expecified length.