Q:

Removing spaces from in between sentences.

I have sentences that I would like to strip spaces out of, but I am reading from a text file. Here's a sample of the words: 
the tree hugged the man
there are many trees
where are the bees

so it should be:
thetreehuggedtheman
therearemanytrees
wherearethebees

Here is what I have so far:
int main(int argc, char* argv []) {

    int i = 0, line = 6;
    char word[100];

    char const* const fileName = argv[1];
    FILE *file = fopen(fileName,"r");
    while(line--){
        fgets(word, 100, file);
        i++;
        char *wordRev = reverse(word);

        // Remove spaces from string here

    }

    fclose(file);

    return 0;
}

A:

With use of strtok and sprintf you can achieve that -
char s[100];                                  // destination string
int i=0;
while(fgets(word, 100, file)!=NULL){          // read from file
    memset(s,'\0',sizeof s);                  // initialize (reset) s in every iteration
     char *token=strtok(word," ");            // tokenize string read from file
     while(token!=NULL){                      // check return of strtok         
          while(s[i]!='\0')i++;                  
          sprintf(&s[i],"%s",token);         // append it in s   
          token=strtok(NULL," ");
      }
    printf("%s\n",s);                         // print s
}

Controlling loop using fgets . Loop will stop as fgets return NULL. 
Note that s will be modified in each iteration , so copy the modified string to another array if you want to use it later in program.

