title: Strange string output
body: <p>I am learning C and I don't understand the output I get when printing the string myString after the calls to functions ayInFrontOfConsonant() and replaceChars(). The goal of this stage of the exercise is that the user can input a string. The string should then be printed like this: all lower case vowels should be replaced with the letter 'a' and in front of each word that starts with a consonant the letter "ay" should be added. When I enter the string "I like writing C code" the output should be: "I aylaka aywrating ayC aycada". I am getting this output however at the end of this string I am getting some strange symbols. It is like it is the 72 characters of the string and some of these characters are random in memory. </p>
  
  <p>I would really appreciate any help you can provide.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  void insertChar(char *str, char aChar, int index)
  {
      int i=0;
      for(i=strlen(str);i&gt;=index;i--)          //sizeof of strlen???
      {
          str[i]=str[i-1];
      }
      str[index]=aChar;
  }
  
  
  void ayInFrontOfConsonant(char *str)
  {
      char *consonants="bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ";
      int i=0,j=0;
      for ( i = 0;i&lt;strlen(str) ; i++)                 
      {
          for ( j = 0; j &lt; strlen(consonants); j++)
          {
              if (str[i] == consonants[j] &amp;&amp; i==0)       
              {
                  insertChar(str, 'y', i);
                  insertChar(str,'a',i);
                  break;
              }
              else if(i!=0 &amp;&amp; str[i-1]==' ' &amp;&amp; str[i] == consonants[j])    
              {
                  printf("i=%d\n",i);
                  insertChar(str, 'y', i);
                  insertChar(str,'a',i);
                  break;
              }
          }
      }
  }
  
  int replaceChars(char str[], char sChar[], char rChar)
  {
      int cnt=0,i=0,j=0;
      for(i=0;i&lt;strlen(str);i++)
      {
          for(j=0;j&lt;strlen(sChar);j++)
          {
              if(str[i]==sChar[j])
              {
                  str[i]=rChar;
                  cnt++;
              }
          }
      }
      return cnt;
  }
  
  
  int main()
  {
      printf("** Welcome to the Double Dutch game **\n");
      char myString[72];
      printf("Please enter a string: ");
      scanf("%[^\n]s", myString);
      replaceChars(myString, "eiou", 'a');
      ayInFrontOfConsonant(myString);
      printf("Double dutch traslation: %s\n",myString);
  
      return 0;
  }
  </code></pre>