// linked list code
#include <stdio.h>
#include <stdlib.h>
#define max 10
typedef struct list
{
int dat;
struct list *next;
}list;
int main()
{
list a,b,c,d,e; // list variables
list *ptr; // pointer of type list whihc points to list variables
a.dat =5;
a.next= &b;
b.dat=4;
b.next =&c;
c.dat=3;
c.next =&d;
d.dat=3;
d.next=NULL;
ptr=&a;
while(ptr!=NULL)
{
printf("value at location %d \n", ptr->dat);
ptr=ptr->next;
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#define max 10
typedef struct list
{
int dat;
struct list *next;
}list;
int main()
{
list a,b,c,d,e; // list variables
list *ptr; // pointer of type list whihc points to list variables
a.dat =5;
a.next= &b;
b.dat=4;
b.next =&c;
c.dat=3;
c.next =&d;
d.dat=3;
d.next=NULL;
ptr=&a;
while(ptr!=NULL)
{
printf("value at location %d \n", ptr->dat);
ptr=ptr->next;
}
return 0;
}