#include <stdio.h>
int main()
{
int num = 0;
const int num2 = 0;
switch(num)
case num:
printf("a\n");
case num2:
printf("b\n");
case 0:
printf("c\n");
case -1:
print("d\n");
case 1:
print("e\n");
default:
printf("f\n");
switch(num2)
case num:
printf("a\n");
case num2:
printf("b\n");
case 0:
printf("c\n");
case -1:
print("d\n");
case 1:
print("e\n");
default:
printf("f\n");
}
C:\Users\\Documents\Dev-C++\이름없음1.c: In function 'main':
C:\Users\\Documents\Dev-C++\이름없음1.c:9:3: error: case label does not reduce to an integer constant
case num:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:11:3: error: case label not within a switch statement
case num2:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:13:3: error: case label not within a switch statement
case 0:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:15:3: error: case label not within a switch statement
case -1:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:17:3: error: case label not within a switch statement
case 1:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:19:3: error: 'default' label not within a switch statement
default:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:23:3: error: case label does not reduce to an integer constant
case num:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:25:3: error: case label not within a switch statement
case num2:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:27:3: error: case label not within a switch statement
case 0:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:29:3: error: case label not within a switch statement
case -1:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:31:3: error: case label not within a switch statement
case 1:
^
C:\Users\\Documents\Dev-C++\이름없음1.c:33:3: error: 'default' label not within a switch statement
default:
^
---
왜 에러가 나는거지
스위치문에 중괄호 어디감? - dc Cpp
ㄳ ㅠㅠ