title: Program stops working after entering the value for more than 6 users
body: <p>I have a school project which asks me to write a code using struct and functions, regarding sales in Greek cities. You are prompted to enter the values of 'em. The program works just fine if I enter that there's 6 salesmen, but a number larger than that makes it stop after entering all the values.. An example would be: </p>
  
  <p><strong>Number of salesmen: 7</strong></p>
  
  <p>(</p>
  
  <ol>
  <li><p>Enter the his id:</p></li>
  <li><p>Enter his surname:</p></li>
  <li><p>Enter the number of sales:</p></li>
  <li><p>Enter the area code:  </p></li>
  </ol>
  
  <p>) x7 times. </p>
  
  <p>Then, when you enter the last value, it would just stop. Not exit, not stop responding/crash, literally just stop, and you would be unable to type anything more, only option would be to exit.</p>
  
  <p>Thing is, there's no error or warning in both the build messages and the log, which has me quite confused. </p>
  
  <p>My guess is that the error is in the function "calcSales" but I wanted to post the whole code just in case you need more info on it.</p>
  
  <p>Could you take a look at the code and tell me if you find anything wrong? Thank you.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "genlib.h"
  #include &lt;simpio.h&gt;
  #include &lt;string.h&gt;
  #define N 20
  #define M 4
  
  struct{
       int id;
       char surname[16];
       long sales;
       int area;
  } salesmen[N];
  
  void info(int *count);
  void calcSales(int *count);
  
  int main(){
  
       int count;
  
       printf("Give me the number of salesmen:\n");
       count=GetInteger();
  
       info(&amp;count);
  
       calcSales(&amp;count);
  }
  
  void info(int *count){
  
  for (int i=0; i&lt;*count; i++){
      printf("\nInfo for salesman number %d:\n", i+1);
  
      printf("\nGive me his id: ");
          salesmen[i].id=GetInteger();
  
      printf("\nGive me his surname: ");
          gets(salesmen[i].surname); 
  
      printf("\nGive me the number of sales: ");
          salesmen[i].sales=GetLong();
  
      printf("\n 1=Thessaloniki, 2= Athens, 3= Volos, 4= Hrakleio \n");
      printf("\nLastly, give me the number of his area: ");
          salesmen[i].area=GetInteger();
  
      if (salesmen[i].area&gt;4){
          printf("\nThe number you are trying to enter doesn't match to an area.\n");
          break;
          }
      }
  }
  
  void calcSales(int *count){
  
  
      long tSales[4];
      for (int i=0; i&lt;*count; i++){
      tSales[i]=0;
      }
  
  for (int i=0; i&lt;*count; i++){
  
      if(salesmen[i].area==1){
              tSales[0]+=salesmen[i].sales;
          }
      if(salesmen[i].area==2){
              tSales[1]+=salesmen[i].sales;
          }
      if(salesmen[i].area==3){
              tSales[2]+=salesmen[i].sales;
          }
      if(salesmen[i].area==4){
              tSales[3]+=salesmen[i].sales;
      }
  }
  
  for (int i=0; i&lt;4; i++){
      printf("\nSales for area number %d: %ld\n",i+1, tSales[i]);
      }
  }
  </code></pre>