#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
typedef struct node item;
void main()
{
item *head[10];
int i;
for(i=0;i<10;i++)
{
head[i]=malloc(sizeof(struct node));
head[i]->data=i+5;
head[i]->next=head[i+1];
}
head[10]=NULL;
for(i=0;i<10;i++)
{
printf(“Address of head[%d] is %p and value is %d\n”,i,&head[i],head[i]->data);
}
}
its executing but am confused can smone tell me ??
if i comment the statement head[i]->next=head[i+1],
its still executing with the same output