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 |
How many main () function we can have in a project?
Explain the difference between getch() and getche() in c?
What is the condition that is applied with ?: Operator?
void swap(int a,int b) { a=a+b; b=a-b; a=a-b; } in this code always gives the same result for all case
What is an lvalue?
What is the difference between exit() and _exit() function in c?
How do you list files in a directory?
What does *p++ do? What does it point to?
What is the difference between memcpy and memmove?
for(;;) printf("C language") What is out put of above??
2 Answers Practical Viva Questions,
What does 3 periods mean in texting?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?