Skip to content

Instantly share code, notes, and snippets.

@EJackYang
Created September 17, 2025 17:08
Show Gist options
  • Select an option

  • Save EJackYang/ef242b2dd53ffd7da839c763e75aa7b1 to your computer and use it in GitHub Desktop.

Select an option

Save EJackYang/ef242b2dd53ffd7da839c763e75aa7b1 to your computer and use it in GitHub Desktop.
分享一种很奇怪的switch case写法.....启发点在2013年的AY代码里面学的
#include<stdio.h>
int main(void){
char symbol;
scanf("%c",&symbol);
switch (symbol) {
case 'a': case 'A':
printf("Fuck A");break;
case 'b': case 'B':
printf("Fuck B");break;
default: break;
}
return 0;
}
@EJackYang
Copy link
Author

当有多个条件都具有同一个输出的情况下,可以用使用这样进行判断操作和输出

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment