error: #268: declaration may not appear after executable statement in block

created at 12-27-2021 views: 59

error

Error: #268: The declaration may not appear after the executable statement block. That is, the variable should be declared at the beginning of the main function and cannot appear after the executable statement. For example:

wrong code

int main(){
  Beep_Init();
  float lenght;
  while(1){
  }
}

correct code

Should be changed to:

int main() {
  float lenght;
  Beep_Init();
  while(1){
  }
}

After the change, recompile it and it will be OK.

created at:12-27-2021
edited at: 12-27-2021: