title: How can I make an interactive menu with C?
body: <p>For some reason my program will print the menu (with the ShowMenu function) and then just end the program. I tried debbuging but no problem appeared.</p>
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;math.h&gt;
  #include &lt;stdbool.h&gt;
  
  int main() {
      bool Again = true;
      char* MenuName = &quot;Games&quot;;
      char* MenuOptions[] = {&quot;Tetris&quot;, &quot;Paintball&quot;, &quot;Wakfu&quot;, &quot;Dofus&quot;, &quot;Pokemon&quot;, &quot;Legend of Zelda&quot;, &quot;Super Mario bros&quot;, &quot;Metroman&quot;};
      int MenuSize = sizeof(MenuOptions);
      int Input = MenuSize + 1;
      printf(&quot;This program will show an interactive menu\n&quot;); //What it does
      ShowMenu(MenuName, MenuOptions, MenuSize, Again, Input);
      return 0;
  }
  
  void ShowMenu(char* MenuName, char* MenuOptions[], int MenuSize, bool Again, int Input){
      while (Again){
          printf(&quot;%s\n&quot;, MenuName);
          for (int i = 0; i &lt; MenuSize; i++){
              printf(&quot;%d - %s\n&quot;, i, MenuOptions[i]);
          }
          MenuSelection(Input, MenuOptions, MenuSize, Again);
      }
  }
  
  void MenuSelection (int Input, char* MenuOptions[], int MenuSize, bool Again){
      printf(&quot;Please choose an option within the menu\n&quot;);
      scanf(&quot;%d&quot;, &amp;Input);
      if (Input &gt; 0 &amp;&amp; Input &lt; MenuSize){
          return printf(&quot;%s\n&quot;, MenuOptions[Input]);
          Again = false;
      }
  }```
  </code></pre>