title: End Of Array Segmentation Fault
body: <p>I have a strange-looking problem that I've encountered while trying to draw a few circles digitally, using C.</p>
  
  <p>What seems to be happening is that the printing-out part of the code works as intended. It prints out every single item in the array. The error comes right at the end - immediately after the last item is printed out, the terminal throws out a segmentation fault.</p>
  
  <p>After a bit of testing, I concluded that this happens every time I try to print out an element in the array, whether I'm printing out the full thing or just a part of it. I even tried just printing out the first "line" of the array - it returned the line just fine, but threw that same fault afterwards. </p>
  
  <p>I'm a complete beginner in C, but suspect that the problem lies in having overwrote the null terminator in my array. Whether this is nor is not the case, I'm not sure how to fix this problem. Any suggestions?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define EW 707
  #define EH 600
  
  int ec[EH][EW][3] ;
  int main(void)
  {
     int y , x , blah ;
     char arr[80] ;
     FILE* fin ;
     fin = fopen( "input.ppm" , "r" ) ;
     fscanf( fin , "%s" , arr   ) ;
     fscanf( fin , "%d" , &amp;blah ) ; 
     fscanf( fin , "%d" , &amp;blah ) ; 
     fscanf( fin , "%d" , &amp;blah ) ; 
  
     for( y = 0 ; y &lt; EH ; y++ )
     {
     for( x = 0 ; x &lt; EW ; x++)
        {
           fscanf( fin , "%d" , ec[y][x] + 0 ) ;
           fscanf( fin , "%d" , ec[y][x] + 1 ) ;
           fscanf( fin , "%d" , ec[y][x] + 2 ) ;
        }
     }
     close( fin ) ;
     for(y = 0; y &lt; EH; y++)
     {
         for(x = 0; x &lt; EW; x++)
         {
             for(blah = 0; blah &lt; 3; blah++)
             {
                 printf("%d %d %d \n", y, x, blah);
                 printf("%d \n", ec[y][x][blah]);
             }
         }
    }
  </code></pre>
  
  <p>}</p>