title: How do I remove a newline that is the last char in an array?
body: <p>So, I am trying to remove a newline that is the last char in an array. The issue is, that in earlier lines I need the newline break, so when I create the array, I leave it in there, so it looks like this:</p>
  <pre><code>fgets(input, 100, stdin);
  
  char *array[10];
  int i = 0;
  
  array[i] = strtok(input, &quot; &quot;);
  
  while(array[i] != NULL)
      array[++i] = strtok(NULL, &quot; &quot;);
  </code></pre>
  <p>but later on, when I run</p>
  <pre><code>execvp(&quot;echo&quot;, array);
  </code></pre>
  <p>It has an extra line break that I can't get rid of, like this (what it would look like from console):</p>
  <pre class="lang-none prettyprint-override"><code>(input) echo &quot;hello&quot;
  (output) hello
  (output)
  *Continues code from here*
  </code></pre>
  <p>I am just wondering if anyone has any ideas on how I could remove the linebreak so, that when I run the <code>execvp</code>, there would not be an extra line?</p>