PROGRAM:
#include <stdio.h>
#include <stdlib.h>
typedef struct _list {
int data;
struct _list *next;
}list;
int main(int argc, char **argv)
{
printf("\n.. Start of singly linked list reverse program .. \n\n");
list *head=NULL, *head_start=NULL, *display = NULL;
list *newnode;
int a = 0;
/* Add 5 elements to linked list */
for (; a<10; a++)
{
newnode = malloc(sizeof(list));
newnode->data = a+1;
newnode->next = NULL;
if (a==0) {
head = newnode;
head_start = newnode;
}
else {
head->next = newnode;
head = head->next;
}
}
#include <stdlib.h>
typedef struct _list {
int data;
struct _list *next;
}list;
int main(int argc, char **argv)
{
printf("\n.. Start of singly linked list reverse program .. \n\n");
list *head=NULL, *head_start=NULL, *display = NULL;
list *newnode;
int a = 0;
/* Add 5 elements to linked list */
for (; a<10; a++)
{
newnode = malloc(sizeof(list));
newnode->data = a+1;
newnode->next = NULL;
if (a==0) {
head = newnode;
head_start = newnode;
}
else {
head->next = newnode;
head = head->next;
}
}