title: Elevator Program has error (Segmentation fault)
body: <p>I am new to C language and I have a problem with my code. (Sorry for my english)
  I am trying to make an elevator program but When I compile it(gcc), I have a Segmentation fault error. Here is my code.</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
  
  /* Elevator Program */
  
  
  char elevArr[11]={0};
  int pressFloor[3][11]={0}, q=0;
  
  void PrintFloor() { // Printing floors status
      for(int i=9; i&gt;=0; i--) {
          printf("%3d %3c\n", i+1, elevArr[i]);
      }
      putchar('\n');
  }
  
  void InputFloor() { // Place what floor's button is pressed
      int floor;
      printf("Enter (floor, Up/down): ");
      scanf("%d", &amp;floor);
      pressFloor[0][q]=floor;
  }
  
  void UpDownFloor() { // Button for Up Down
      int ud;
      scanf("%d", ud);
      pressFloor[1][q]=ud;
  }
  
  int main() { // main module
      bool Isfirst=true; // if the program is first runned
      printf("\nElevator Program\nCreated by JSChang\nTo exit type (0, 0)\n\n");
      elevArr[0]='E';
      while(1) {
          if(Isfirst==true) {
              PrintFloor();   
              Isfirst=false;
          } else {
              q=0;
              for(int i=0; i&lt;10; i++) {
                  InputFloor();
                  UpDownFloor();
                  if(pressFloor[0][i]==0 &amp;&amp; pressFloor[1][i]==0)
                          break;
              }
  
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>Thanks a lot!</p>