title: Error in switch case, a label can only be part of a statement and a declaration is not a statement
body: <p>I am creating a simple menu with switch case so depending on the value written it can do different things,</p>
  <pre><code>void
  menu_principal()
  {
      int opciones;
  
      printf (&quot;Ingrese su eleccion \n&quot;);
  
      scanf(&quot;%d&quot;, &amp;opciones);
  
      switch(opciones) 
      {
          case 1: 
              
              int coord_x;
              int coord_y;
              
              printf(&quot;Ingrese las cordenadas de x \n: &quot;);
              scanf( &quot;%d&quot;, &amp;coord_x);
              
              printf(&quot;Ingrese las cordenadas de y \n&quot;);
              scanf( &quot;%d&quot;, &amp;coord_y );
              
              break;
          
          
          case 0:        
              
              break;
          
          …
            
      }
      return 0;
  
  }
  </code></pre>
  <p>but it just doesn't work, I get errors with the <code>scanf</code> and the <code>int coord_x</code>, <code>coord_y</code>.</p>