program to Reverse a linked list
Answers were Sorted based on User's Feedback
Answer / vikram singh saini
Here is the link:
http://niitdeveloper.blogspot.com/2010/12/accept-integers-print-in-reverse-order.html
This code accepts integers or numbers from user and print
them in reverse order using linkedlist.
| Is This Answer Correct ? | 6 Yes | 12 No |
Answer / shruthirap
node *reverse(node *first)
{
node *temp = NULL;
if(first->next != NULL)
{
temp = reverse(first->next);
temp->next = first;
return first;
}
else
return first;
}
//The only catch is that the supposed to be first node after
reordering, has to be kept either in some global pointer or
passed back by function. That's it :)
| Is This Answer Correct ? | 16 Yes | 36 No |
prog. to produce 1 2 3 4 5 6 7 8 9 10
How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];
main() { extern int i; i=20; printf("%d",sizeof(i)); }
There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.
Give a one-line C expression to test whether a number is a power of 2.
#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }
Write a program to receive an integer and find its octal equivalent?
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
Write a c program to search an element in an array using recursion
void main() { int i=5; printf("%d",i+++++i); }