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 |
Table of Sudoku n*n
Explain how do you generate random numbers in c?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is a far pointer?What is the utility?
what is the value of 'i'? i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green")
7 Answers Cadence, JNTU, Zen Technologies,
what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}
How to implement call back functions ?
What are the 32 keywords in c?
if function is declared as static in one source file, if I would like to use the same function in some other source file...is it possible....how ?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
What does != Mean in c?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .