title: strcmp changing the value of a string
body: <pre><code>void search(char*** p, int numOfWords, int* pNumOfDefArr){
  int i, j, index;
  char* word = (char*)malloc(WORD_SIZE * sizeof(char));
  for (i = 0; i &lt; N; i++) //just clearing the screen
      printf("\n");
  printf("Hello and thank you for filling Dictionary 1.0 with new words!!\n");
  printf("Which word are you looking for??\n");
  gets(word);
  fix_word(word, 0);
  while (strcmp(word, "Exit")){
      index = (search_word(p, word, 0, numOfWords - 1, 0));
      if (index &lt; 0)
          printf("Unknown word!!!!!!\n");
      else{
          for (j = 0; j &lt; pNumOfDefArr[index]; j++)
              printf("%s\n", *(*(p + index) + 1 + j));
      }
      free(word);
      char* word = (char*)malloc(WORD_SIZE * sizeof(char));
      printf("Looking for another word?\n");
      gets(word);
      fix_word(word, 0);
  }
  printf("Farewell!!\n");
  </code></pre>
  
  <p>On the debugger I can see that on the 10th line: <code>while (strcmp(word, "Exit"))</code> the value of word is
  changing from <strong>"asd"</strong> to <strong>"Error reading characters of string."</strong>  Why is that? </p>
  
  <p>Here's the code for the <code>fix_word()</code> function:</p>
  
  <pre><code>void fix_word(char* pword, int j){
      if (*(pword + j) != '\0'){
          if (j == 0 &amp;&amp; (*(pword + j) &gt;= 'a' &amp;&amp; *(pword + j) &lt;= 'z')){
              *pword -= N;
              j++;
          }
          else if (*(pword + j) &gt;= 'A' &amp;&amp; *(pword + j) &lt;= 'Z'){
              *(pword + j) += N;
              j++;
          }
          else
              j++;
          fix_word(pword, j);
      }
  }
  </code></pre>