#include <iostream> int main(){ int i = 1; switch (i){ case 1 : int j ; j = 1; break; case 2: std::cout<<j; } }
switch supports the definition of variables, and the other case is visible, so avoid problems, case should be wrapped in braces
#include <iostream> int main(){ int i = 1; switch (i){ case 1 : int j ; j = 1; break; case 2: std::cout<<j; } }
switch supports the definition of variables, and the other case is visible, so avoid problems, case should be wrapped in braces