title: LTRIM function in C
body: <p>I am trying to write a left trim function in C. Could someone please find out what is the mistake I am doing</p>
  
  <pre><code>int main()
  {
    char string2[]="   wind";
    ltrim(string2);
    int new_len2=strlen(string2);
    printf("After trim String2 is &lt;%s&gt;\nLength is %d\n",string2,new_len2);
    return 0;
  }
  
  void ltrim(char *string)
  {
   int i=0;
   while(string[i]==' ')
     {
      i++;
      string=string+i;
     }
  printf("inside function string is &lt;%s&gt;---length is %d\n",string,strlen(string));
  }
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>inside function string is &lt;wind&gt;---length is 4
  After trim String2 is &lt;   wind&gt;
  Length is 7
  </code></pre>
  
  <p>Why the string is not changing in the main function after trimming.</p>