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 |
what is the difference between declaration ,defenetion and initialization of a variable?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
0 Answers College School Exams Tests,
what is the difference between these initializations? Char a[]=”string”; Char *p=”literal”; Does *p++ increment p, or what it points to?
for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
can we change the default calling convention in c if yes than how.........?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Why is c called a structured programming language?
In how much time you will write this c program? Prime nos from 1 to 1000
How do you write a program which produces its own source code as output?
What are two dimensional arrays alternatively called as?
code for quick sort?
how many error occurs in C language ?