Computer Science, asked by sahebroy188, 10 months ago

There are five nodes in a single linked list having one
integer in each node. Write a programme in c
language to implement the reverse list.​

Answers

Answered by venkatavineela3
3

Answer:

i have sent just the logic

Explanation:

#Include<stdio.h>

struct node

{

int data;

struct node*next;

}node1,node2;

void insertnode(int a)

{

struct node*temp=NULL,*head,*cur;

temp=(node*)malloc(sizeof(node));

temp->data=a;

temp->next=NULL;

if(head==NULL)

{

head=temp;

cur=temp;

}

else

{

cur->next=temp;

cur=temp;

}

}

void reverse(node*head)

{

int a[10];

while(i!=10)

{

for(temp=head;temp->next!=NULL;temp=temp->next)

         a[i]=temp->data;

i++;

}

while(i!=10)

{

for(temp=head;temp->next!=NULL;temp=temp->next)

         temp->data=a[i];

i++;

}

}

}

Similar questions