title: Any reason why this "make a triangle loop" loops for longer than necessary
body: <p>I have this function that will make an array of chars (ie a string) into a right triangle. It works but then it keeps going even after the array has stopped. So the output always has many extra lines of blank space.</p>
  
  <p>and if the word is long enough random symbols will appear at the end of that blank space. This is probably because the blank space exited the arrays size of 100. 
  I dont know whats causeing this. I tried to set conditions to the counter and the printf that makes a new line but that just breaks the code entirely. I thought it was definitely the printf for new lines doing it but it doesnt seem like it now after trying that. 
  Does anyone see whats wrong?</p>
  
  <p>Below is the remote function from my code.</p>
  
  <pre><code>#include &lt;stdio.h&gt; 
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  
  #define clear system("cls") 
  #define pause system("pause") 
  
  
  void triangulate(char stringArray[]){
      int i,j,len = 0;
      int counter=0;
      len=strlen(stringArray);//a function library function that returns the length
  
      printf("\n");
      for(i=1;i&lt;=len;++i){
          for(j=1;j&lt;=i;++j){
              printf("%c",stringArray[counter]);
              counter++;
          }
          printf("\n");
  
      }
      printf("len:%i counter:%i",len, counter);
      pause;
  }//end triangulate()
  </code></pre>