title: Longest Common Suffix Is Producing Garbage Values
body: <p>I'm having trouble writing a program that gets two words and finds the longest common suffix. Whenever I try to copy the contents from the words into my new string &quot;suffix&quot; I keep getting garbage values and I am struggling to find out where I went wrong. Any and all feedback is appreciated!</p>
  <pre><code>void longest_suffix(char word1[], char word2[]){
      char suffix[20];
      int count = 0;
  
      int end = strlen(word2) - 1;
  
      int j = 0;
      for(int i = strlen(word1)- 1; i &gt;= 0; i--){
          if(word1[i] == word2[end - j]){
              count++;
          }
          j++;
      }
  
  
      int z = 0, k = 0;
      for(k = 0; k &lt; count; k++){
          suffix[k] == word2[end - count + z];
          z++;
      }
      suffix[k] = '\0';
      printf(&quot;%s&quot;, suffix);
  }
  </code></pre>