C1445: Initialization of <Variable> is skipped by 'default' label

[ERROR]

Description

Initialization of a local variable is skipped by a 'default' label.

Example
    void main(void){

  
      int i;

  
      

  
      switch(i){

  
        case 0:

  
          //...

  
          break;

  
        int myVar = 5;

  
        default:          // C1445 init skipped

  
          //...

  
          break;  

  
      }

  
Tips

Declare the local variable in the block where it is used.

    void main(void){

  
      int i;

  
      

  
      switch(i){

  
        case 0:

  
          //...

  
          break;

  
        default:

  
          int myVar = 5;

  
          //...

  
          break;  

  
      }