The code is supposed to take in as many string as the user wants to put in until they enter EOF. and it is doing that but after i try to ouput the code it comes out with these little half boxes instead of the string.
void sortString(char *s[], int count);
int main(){
int i;
char buff[BUFSIZ];
int count;
char** s = (char**)malloc(sizeof(char*));
//allows user to keep typing until EOF is reached.
printf("Here is the list of unsorted names: \n\n");
for (count = 0; fgets(buff, sizeof(buff), stdin); count++)
{
s[count] = malloc((sizeof(buff))*sizeof(char));//allocats memory at s[count].
strcpy(buff, s[count]);//adds the string in buff to s[count].
s = (char**) realloc(s, ((sizeof(s) + sizeof(buff)) * sizeof(char*)) + 1);//then reallocats memeory for s to take another string.
}
printf("\nCount is %d\n\n", count);
// Now sort string using sortString function
// Step 4: implement sortString function for the above-mentioned function declaration
for (i = 0; i < count; i++){
printf("%s \n",s[i]);
}
sortString(s, count);
printf("Here is the list of sorted names: \n\n");
for (i = 0; i < count; i++){
printf("%s",s[i]);
}