title: How to delete a newline within a string
body: <p>I want to delete a Newline '\n' within a string.</p>
  
  <pre><code> char *string ="hallo\n";
  
      int i=0;
      int length = sizeof(string);
  
      while(i&lt;length)
      {
          if(string[i+1] == '\n')
          {
              string[i+1] = '\0';
              break;
          }   
          i++;
      }
  
      printf("%s",string);
      printf("world");
  </code></pre>
  
  <p>I know that I could just spawn a new array and it works like this</p>
  
  <pre><code>char *string ="hallo\n";
  
  int i=0;
  int length = sizeof(string);
  int lengthNew = length -1;
   char newStr[lengthNew];
      while(i&lt;length)
      {
          printf("Char ist %c:",string[i]);
          newStr[i] = string[i];
          if(string[i+1] == '\n')
              break;
          i++;
      }
  </code></pre>
  
  <p>But why using stack if I just could substitude one character in the old array?</p>