title: char* change when applying a function
body: <p>I am trying to implement a function which transform a <code>char*</code> of the form <code>[name]</code> into <code>name</code>.
  Here is my function : </p>
  
  <pre><code>char* rmChar (char* tagName){
      char* newName = tagName;
      newName++; //remove first character
      unsigned long len = strlen(newName)-1;
  
      if (newName[len] == '\n'){
          newName[len] = 0;
          newName[len-1] = 0;
      }
      else{
          newName[len] = 0;
      }
  
      return newName;
  }
  </code></pre>
  
  <p>What I don't understand is that if I apply my function on a variable of type <code>char*</code> it will modify it. 
  For example if I run the following code : </p>
  
  <pre><code>char test[] =  "[test]";
  printf("%s", rmChar(test));
  printf("%s", test);
  </code></pre>
  
  <p>then it prints out : <code>test[test</code></p>
  
  <p>I don't understand why the variable has been change into <code>[test</code> ? 
  is there a way to modify my function rmChar such that the variable <code>test</code> is unchanged ? </p>
  
  <p>Thank you !</p>