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 |
#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }
#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
Write a C function to search a number in the given list of numbers. donot use printf and scanf
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
write a c-program to display the time using FOR loop
What is the main difference between STRUCTURE and UNION?
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }
How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!
main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }