All I want to do is ask the user to enter words, then I bubble sort them alphabetically, then print them back out. THE PROBLEM IS.. When I try to store "str" into the words array, idk what's happening... When I print them out, it's only saving the LAST word I typed into every array location..
I realize "char*s are not strings. They are pointers"
#define MAXLENGTH 15
#define MAXWORDS 3
int _tmain(int argc, _TCHAR* argv)
printf("Enter a word: ");
fgets(str, MAXLENGTH, stdin);
/* remove newline, if present */
i = strlen(str)-1;
if( str[i] == '\n')
str[i] = '\0';
But how do I fix this?
All I want to do is ask the user to enter strings 1 line at a time, and have them saved in an array.
Then sort the strings alphabetically in the array.
Then print it.
That's all!!.. I have the sorting working, I just don't have the storing the strings from the user into the array!