fflush(stdin); Un-oh.
6000 or 1000?
Could you attach the file to be sorted?
What the heck is a supposed to be?
char a[0][1000];
Does this compile for you? (Please compile C code with a C compiler.)
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
> char temp[81]="";
But apparently your words are up to 1000 characters long.
Fix this, or fix your arrays.
> y[1000][1000]
1MB of unused space, just get rid of it.
It seems to me that you're likely to be blowing away your entire stack (and much more) before you've even begun.
Start with a small file of only say 10 short strings and verify that your algorithm works. Then scale it up to full size.
Try it with a file of only TWO words, and step through the code with a debugger.
> if (strcmp(a[d],a[lower])<=0)
Try using the x array (the one you read into) rather than something completely useless liike your a array.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Attempt to run the program after restarting your computer, if that does not work then make sure that your opperating system supports the program that you're attempting to run
Could you, um, please explain your reasoning?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177