当前位置:网站首页>Error: case label `15 'not within a switch statement

Error: case label `15 'not within a switch statement

2022-07-06 16:44:00 HBUcs2020

error : When switch( Variable / value ) Statement by semicolon ( ; ) At the end of ,C In language case label Use switch case Statement to C Language appears .

#include <stdio.h>
 
int main(void) {
	
	int choice = 2;
	
	switch(choice)
	{
	    case 1:
	        printf("Case 1\n");
	        break;
	    case 2:
	        printf("Case 2\n");
	        break;	    
	    case 3:
	        printf("Case 3\n");
	        break;	    
	    case 4:
	        printf("Case 4\n");
	        break;	    
	    default:
	        printf("Case default\n");
	}
	
	return 0;
}

原网站

版权声明
本文为[HBUcs2020]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131314583926.html