title: Iterating over 3D Arrays
body: <p>I keep on getting this Bus Error 10 on my code and I have no idea why.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  
  #define SIZE 100
  
  int main() {
  
      char input[SIZE];
  
      int dummy[SIZE];
  
      int array[SIZE][SIZE][SIZE];
  
      int set=-1;
      int sequence=0;
  
  
      while (1==1) {
         if (fgets(input, SIZE-1, stdin) == NULL){
           printf("Input Error.");
           break;
         }else {
  
           char* s;
  
           for (s = input; (*s != '\n') &amp;&amp; isspace(*s); s++){
              ; 
           }
  
           if (*s == 'f'){ //start of finish
  
              break; 
  
           } else if (*s == 'S'){ //start of SET
  
              set++;
  
           } else{
  
              sscanf(input, "%d: %d, %d, %d, %d, %d", &amp;dummy[0], 
              &amp;dummy[1], &amp;dummy[2], &amp;dummy[3], &amp;dummy[4], 
              &amp;dummy[5]);
  
              array[set][sequence][0]=dummy[0];
  
              array[set][sequence][1]= 
              dummy[1]+dummy[2]+dummy[3]+dummy[4]+dummy[5];
  
              sequence++;
  
           }
  
         }
       }
  
      for (int i=0; i&lt;sizeof(array); i++ ){
          printf("SET %d\n", i+1);
          for (int j=0; j&lt;sequence;j++){
              printf("%d", array[i][j][0]);
              for (int k=0; k&lt;=5; k++){
                  printf("%d\n", array[i][j][1]);
              }
          }
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Basically if I have an input of a certain number of sets and a sequence of numbers. Like so:</p>
  
  <pre><code>SET 1
  
  1: 5,5,6,5
  2: 3,4,5,5
  3: 3,4,5,6
  
  SET 2
  
  1: 5,7,8,7
  2: 5,5,5,6
  
  
  finish
  </code></pre>
  
  <p>I want to output the sequence number and sum of all the number after the colon for each sequence in a given set. So it would look something like this.</p>
  
  <pre><code>SET 1
  1 21
  2 17
  3 18
  
  SET 2
  1 27
  2 21
  </code></pre>
  
  <p>But, when I try to execute my code, I get Bus Error: 10. I tried resizing the array but now I can't iterate over my array since it keep returning a bunch of random number. Like: </p>
  
  <pre><code>-34618613832766
  32766
  32766
  32766
  32766
  32766
  1178023731825050672
  825050672
  825050672
  </code></pre>
  
  <p>Where are these numbers from? thanks.</p>