Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- typedef struct ptr
- {
- int x;
- struct ptr *pt;
- }ptr;
- ptr *head=NULL;
- int main()
- {
- ptr *a=(ptr*)malloc(sizeof(ptr));
- a->pt=NULL;
- a->x=01;
- head=a;
- ptr *b=(ptr*)malloc(sizeof(ptr));
- b->pt=NULL;
- b->x=02;
- a->pt=b;
- ptr *c=(ptr*)malloc(sizeof(ptr));
- c->pt=NULL;
- c->x=03;
- b->pt=c;
- ptr *d=(ptr*)malloc(sizeof(ptr));
- d->x=05;
- c->pt=d;
- d->pt=head;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement