write a C code To reverse a linked list
Answers were Sorted based on User's Feedback
Answer / 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 |
a=0; b=(a=0)?2:3; a) What will be the value of b? why b) If in 1st stmt a=0 is replaced by -1, b=? c) If in second stmt a=0 is replaced by -1, b=?
What are register variables? What are the advantage of using register variables?
What is #include called?
what does data structure mean?
What is a string?
How can a process change an environment variable in its caller?
what is pointer
State the difference between x3 and x[3].
Write a C program to fill a rectangle using window scrolling
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
dynamically allocate memory for linear array of n integers,store some elements in it and find some of them
What is the use of bit field?