well this really needs counselling.......
i wish to create a linked list and then print the items of the list;
1 2 3
struct hind
{int data; struct hind * next;}*head;
//the above is declaration of a self-referential structure
now during the building of the list i use the following loop
1 2 3 4 5 6 7 8 9
head=(struct hind *)malloc(sizeof(struct hind));
scanf("%d",&s);
while(s!=-999)//condition for the list to end
{
head->data=s;
scanf("%d",&s);
head->next=head;
head=(struct hind *)malloc(sizeof(struct hind));
}
now what do i do to point the head again to the beginning of the list so that i
may print the nodes of the list..... the method given in books and resources is
not getting in my head..... plz give a way with a suitable explanation; thanx a lot!!!!!!!!!!
I wish I could help you, but everytime I look at your code I get confused. I have no idea what it's doing. Time to do research on my end. But I can help you a little more.
Honestly I don't know what a linked list is, but I can give you some reference material for the list container if that's what you're looking for. http://www.cplusplus.com/reference/stl/list/
More insight on what a linked list might be able to help you out a little more.