I am trying to use the linux's kernel implementation of linked list(list.h), but I keep getting the following error:- invalid type argument of -> (have 'int')
struct klist
{
int data;
struct list_head list;
};
int main()
{
int i;
struct klist *_lptr;
LIST_HEAD(klist_head);
for(i=0;i<10;i++)
{
_lptr=(struct klist*)malloc(sizeof(struct klist));
_lptr->data=i;
}
list_for_each_entry(_lptr,&klist_head,list)
{
printf("%d\n",_lptr->data);
}
}