title: Insertion Sort Segmentation Fault
body: <p>I have two global Variables <code>COUNT=0;</code> and <code>SIGN=0;</code>
  Then I <code>#define SIZE 100</code></p>
  
  <p>I keep getting a seg fault in my code but I'm not too sure where, if you guys could help pin it down for me I'd appreciate it.</p>
  
  <p>It is supposed to print out the total number of assignments that go on while it inserts data read in from a txt doc. I'm not sure if I am understanding what an assignment is actually but this is my go out of it.</p>
  
  <pre><code>void insert(int x[], int n){
  int key,y,z;
  COUNT++;
      for(z=1; z&lt;n-1; z++){
          key=x[z];
          SIGN++;
          for(y=(z-1); y&lt;0||key&gt;=x[y]; y--){
              x[y+1]=x[y];
              SIGN++;
          }
          x[y+1]=KEY;
      }
  int main(){
      FILE *fp;
      fp=fopen("data.txt","r");
      int #temp;
      int i=0;
      int *sort=NULL;
      sort=(int *)malloc(SIZE*sizeof(sort));
      while(fp!=NULL){
          fscanf(fp, "%d", temp);
          sort[i]=(int)temp;
          i++;
      }
      insert(sort, SIZE);
      printf("number of Assignments=%d", SIGN);
      return 0;
  }
  </code></pre>