title: rtrim (trimming a string) in C
body: <p>I have a function:</p>
  
  <pre><code>char* rtrim(char* string, char junk)
  {
      char* original = string + strlen(string);
      while(*--original == junk);
      *(original + 1) = '\0';
      return string;
  }
  </code></pre>
  
  <p>Which I call like this:</p>
  
  <pre><code>colTok = rtrim(colTok,"%");
  </code></pre>
  
  <p>colTok is char * which contains string number like "80%". I need to remove the % . I believe I have used the function some time before but now it does not work because when I debug and enter into it, so junk is -49 'Ď' instead '%'. So what's the problem? What I do wrong?</p>