title: STATUS_STACK_BUFFER_OVERRUN encountered
body: <p>I have searched for this particular error and found the underlying issue involves loop counts being wrong and causing the program to exceed it's bounds for the array.</p>
  
  <p>However, after I lowered each array to the point where the array began to lose data on output, it continued to throw the same error. I am still new to C/C++ but any insight into this would be greatly appreciated.</p>
  
  <p>The program seems to run through to the very end and even returns to the main method.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
  
  void sortAr(char[]);
  
      int main ()
  {
      char a='y';
      char b,i;
      char c[20];
      int x=0,n=0,z=0;
      while (x&lt;=19)
      {
          c[x]='@'; 
          x++;
      }
  
      printf("Enter 20 letters: \n"); 
  
      while (z&lt;=20) //(The '=' caused my problem, removed and it runs fine.)
      {
          z++;
          x=0;
          b='y';
          scanf("%c",&amp;i);
          while (x&lt;=19)
          {
              if (c[x]==i)
                  b='n';
              x++;
          }
  
          if (b=='y')
          {
              c[n]=i;
              n++;
          }
      }
      printf("\n");
      printf("The nonduplicate values are: \n");      
  
      sortAr(c);
  
  }
  
  
  
  
  
      void sortAr(char ar[])
      {
          char z;
      for (int i = 0; i &lt;= 19; i++) 
      {
          for (int j=i+1; j &lt;= 19; ++j)
          {
              if (ar[i]&gt;ar[j])
              {
                  z =  ar[i];
                  ar[i] = ar[j];
                  ar[j] = z;
              }
          }
      }
      for (int i = 0; i &lt; 20; i++) 
      {
          if(ar[i]=='@')
              continue;
          printf("%c ", ar[i]);
      }
      printf("\n");
      }
  </code></pre>