First of all I would like to say that I am a super newb at C, and would appreciate any help possible. I have to read a text file of words and sort them in lexicographical order (alpha order), I tried using the bubble sort and got this error on lines 52 and 53. Please help me ... Heres the exact error..
Error E2277 Dictionary.c 52: Lvalue required in function dsort
Error E2277 Dictionary.c 53: Lvalue required in function dsort
IF you can respond asap that would be great,!
#include <stdio.h>
void dsort(char *name, char *words);
int main() {
char name[15];
char words[20][20];
printf("Please Enter a Filename for the dictionary File:\n\n");
scanf("%s", &name);
dsort(name, words);
return 0;
}
void dsort(char *name, char *words) {
char *wds[20][20];
//char wds1[20];
char temp;
int pass;
int i;
FILE *input_file = fopen(name, "r");
fscanf(input_file, "%s%s%s%s%s%s", wds[0],wds[1],wds[2],wds[3],wds[4],wds[5]);
//*words = wds;
printf("The Words are:%s\n%s\n%s\n%s\n%s\n%s\n", wds[0],wds[1],wds[2],wds[3],wds[4],wds[5]);
fclose(input_file);
for (pass=0;pass<6;++pass)
{
for (i=0;i<6;++i)
{
if (wds[i] > wds[i+1])
{
temp = wds[i];
[B]Line52[/B] wds[i] = wds[i+1];
[B]line 53[/B] wds[i+1] = temp;
}
}
}
printf("The NEW Sorted Words are:%s\n%s\n%s\n%s\n%s\n%s\n", wds[0],wds[1],wds[2],wds[3],wds[4],wds[5]);
}