title: Loop and array problem with stopping at one element
body: <p>Scroll for more details</p>
  <p>My code :</p>
  <pre><code>     #include&lt;stdio.h&gt;
  main()
  {
      int T[50], X[50], TEST[50] ,N, i, j, n_indices=0;
      do { printf(&quot;Enter size of aray : &quot;);
           scanf(&quot;%d&quot;, &amp;N);
      } while ( N &lt;= 0 || N &gt; 50);
      
      ////////////////////////////////////////////////
      
      //Filling the array
      printf(&quot;\nRemplissage :&quot;);
      for ( i = 0 ; i &lt; N ; i++ )
      {
          printf(&quot;\n T[%d] = &quot;, i);
          scanf(&quot;%d&quot;, &amp;T[i]);
      }
      
      ///////////////////////////////////////////////
      
      //Array
      printf(&quot;\nArray : &quot;);
      for ( i = 0 ; i &lt; N ; i++ )
      {
          printf(&quot;\n T[%d] = %d &quot;, i, T[i]);      
      }
      
      //////////////////////////////////////////////
      printf(&quot;\n /// Solution /// : &quot;);
      //Problem part
      
      for( i=0 ; i&lt; N ; i++ )
      {
          TEST[i] = T[i];
      }
      
          
      for ( i = 0 ; i &lt; N ; i++ )
      {   
          for ( j=0 ; j &lt; N ; j++ )
          {
              if ( TEST[i] == TEST[j])
              {
              X[n_indices] = j;
              n_indices++;
              }
          }
                  
          //Show results
          for ( j = 0 ; j &lt; n_indices ; j++ )
          {
          printf(&quot;\n T[%d] = %d &quot;, X[j], TEST[X[j]]);     
          }
          printf(&quot;\n //////////// &quot;);
          n_indices=0;
          
          //Removing T[i]
                  
          for ( i=0 , j=0 ; i&lt;N ; i++)
          {
          if (TEST[i] != T[i] )
          {
              TEST[j]=TEST[i];
              j++;
          }
          } 
          
          
              
      }
  </code></pre>
  <p>In the last loop the code stops after one loop.
  The purpose of this program is to show how many times each element is repeated in the array with its correspondant position.
  If possible i would love to know what problem caused this.</p>
  <p>Input :</p>
  <pre><code>    T[0] = 1
      T[1] = 2
      T[2] = 2
      T[3] = 1
      T[4] = 5
      T[5] = 1
  </code></pre>
  <p>what i want as Output:</p>
  <pre><code>    T[0] = 1
      T[3] = 1
      T[5] = 1
      /////////
      T[1] = 2
      T[2] = 2
      /////////
      T[4] = 5
      /////////
  </code></pre>
  <p>what i got :</p>
  <pre><code>    T[0] = 1
      T[3] = 1
      T[5] = 1
      /////////
      
  </code></pre>