Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<malloc>
- struct node
- {
- int value;
- struct node *next;
- }*heal=NULL;
- void insert_first(){
- struct node *ptr, *ptr1, *ptr2;
- ptr=(struct node*)malloc(size of(struct node));
- ptr->next=NULL;
- if(ptr==NULL)
- {
- head=ptr;
- ptr->next=NULL;
- ptr1=head;
- }
- else
- {
- ptr->next=head;
- head=ptr;
- }
- printf("value %d",ptr->value);
- printf("next add %d",ptr->next);
- printf("Own add %d", ptr);
- main()
- {
- int i;
- for(i=0; i<7; i++)
- insert_first();
- }
- *last
- if(head==NULL)
- {
- head=PTR;
- PTR->next=NULL;
- PTR1=head;
- }
- else
- {
- while(PTR1->next!=NULL)
- {
- PTR1=PTR1->next;
- }
- }
- mid
- if(head==NULL)
- {
- head=PTR;
- PTR->next=NULL;
- PTR1=head;
- pos++;
- }
- else
- {
- int i;
- for(i=0;i<pos;i++)
- {
- PTR1=PTR1->next;
- }
- PTR2=PTR1->next;
- PTR1->next=PTR;
- PTR->next=PTR2;
- pos++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement