0
以下switch語句是否正確?我的意思是我可以在一個switch case語句中使用常量和字符文字嗎? 它在代碼中工作,但我從良好實踐的角度要求。C語言中的switch語句
switch(arg[1]) {
case '4':
printf("value is 4\n");
break;
case '6':
printf("value is 6\n");
break;
case 'M':
printf("value is M\n");
break;
default:
break;
}
胡佳'deafult'! – ouah 2014-09-24 18:45:07
或者,你知道,'printf(「value is%c \ n」,arg [1])' – 2014-09-24 18:45:59
單字符文字是一個數字,不像「非常短的字符串」。 – usr2564301 2014-09-24 18:46:08