write a C code To reverse a linked list
Answer Posted / sujith
include <stdio.h>
typedef struct list {
list_t *next;
int data;
}list_t;
list_t *list_reverse(list_t *list)
{
list_t *rlist = NULL;
while (list != NULL)
{
list_t *next = list->next;
list->next = rlist;
rlist = list;
list = next;
}
return rlist;
}
This will do the job.
Plese do verify this.
Sujith
Is This Answer Correct ? | 27 Yes | 12 No |
Post New Answer View All Answers
What does the message "automatic aggregate intialization is an ansi feature" mean?
What does c mean in standard form?
C language questions for civil engineering
How do shell structures work?
What is the purpose of void in c?
define string ?
What is pass by reference in functions?
Write a program with dynamically allocation of variable.
I have a varargs function which accepts a float parameter?
Do you have any idea how to compare array with pointer in c?
What is indirection?
When should the register modifier be used? Does it really help?
Differentiate between functions getch() and getche().
What is a program flowchart and how does it help in writing a program?
Why should I prototype a function?