In this program I created a array(node[3]) of structure(struct eg) and made them as linked lists while trying to print the elements of the list I am getting only 1 output that is 3
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct eg
{
struct eg *next;
int age;
}node[3];
main()
{
struct eg *head,*temp;
int i;
head=temp=node;
for(i=1;i<3;i++)
{
temp->age=i;
temp->next=temp+i;
}
temp->next=0;
temp->age=3;
while(head!=0)
{
printf("%d",head->age);
head=head->next;
}
}