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
Explain the use of #pragma exit?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
How do I round numbers?
What is difference between array and pointer in c?
What is the difference between array and structure in c?
What is the difference between new and malloc functions?
Can you define which header file to include at compile time?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
Do character constants represent numerical values?
What's a good way to check for "close enough" floating-point equality?
Explain how can I open a file so that other programs can update it at the same time?
What is the use of parallelize in spark?
What oops means?
can we implement multi-threads in c.
Why cant I open a file by its explicit path?