title: String Padding in C
body: <p>I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000".</p>
  
  <pre><code>char *StringPadRight(char *string, int padded_len, char *pad) {
      int len = (int) strlen(string);
      if (len &gt;= padded_len) {
          return string;
      }
      int i;
      for (i = 0; i &lt; padded_len - len; i++) {
          strcat(string, pad);
      }
      return string;
  }
  </code></pre>
  
  <p>It works but has some weird side effects... some of the other variables get changed.  How can I fix this?</p>