Error Msg:
error C2360: initialization of 'variable' is skipped by 'case' label.
Error Causes:
Switch-Case 문에서 지역 변수를 할당하려 하지만 스택 영역을 잡을 때 크기를 알 수 없기 때문에 발생.
Error Solutions:
Switch-Case 문에서 지역 변수 선언 및 초기화 시 중괄호("{}")로 코드를 묶어야 함.
Example)
switch(data) {
case 1:
{
int return_data = 100;
}
break;
default:
~~~
'Develop > C++' 카테고리의 다른 글
[Info] 주소가 NULL로 초기화 되지 않고 0xcdcdcdcd로 초기화 됨 (1) | 2023.04.14 |
---|---|
implicit declaration of function 'scanf_s' is invalid in C99 오류 (0) | 2021.12.29 |