使用C切换语言读取字符串

时间:2019-04-04 12:33:53

标签: c

我在使开关盒读取字符串而不是数字时遇到问题,如果可能的话,我希望它同时读取两者。关于如何做到这一点的任何建议?谢谢

1 个答案:

答案 0 :(得分:2)

这是不可能的:案例标签必须是C中可编译时可评估的整数类型。

如果您还有其他需要,请使用%&c使用foreach ($names as $index => $name) { $result = "The student: " . $name . " belongs to group " .$groups[$index % count($groups)]. ".\n"; echo $result; } 块。

(尽管有些人在编写不可移植的代码时可能会使用多字符常量作为大小写标签:请参见This source code is switching on a string in C. How does it do that?