title: Trim function in C, to trim in place (without returning the string)
body: <pre><code>char testStr[] = "          trim this           ";
  char** pTestStr = &amp;testStr;
  trim(pTestStr);
  
  int trim(char** pStr)
  {
   char* str = *pStr;
   while(isspace(*str)) {
    (*pStr)++;
    str++;
   }
  
   if(*str == 0) {
    return 0;
   }
  
   char *end = str + strlen(str) - 1;
   while(end &gt; str &amp;&amp; isspace(*end))
    end--;
   *(end+1) = 0;
  
   return 0;
  }
  </code></pre>