[英]Expected unqualified-id
Im doing a random password generator but I have a problem at a switch.我在做一个随机密码生成器,但我在切换时遇到了问题。
From case 4 to case 18 it says there is an "Expected unqualified-id" and points the '=' sign but I can't get the error.从案例 4 到案例 18,它说有一个“预期的不合格 ID”并指向 '=' 符号,但我无法得到错误。
Is there a problem with the syntaxis or code?语法或代码有问题吗?
My code:我的代码:
switch (a) {
case 0:
char[1] = 'a';
break;
case 1:
char[1] = 'b';
break;
case 2:
char[1] = 'c';
break;
case 3:
char[1] = 'd';
break;
case 4:
char[1] = 'e';
break;
Problem : You can not name your array char
, because this is a reserved word in C++ .问题:您不能将数组命名为char
,因为这是C++ 中的保留字。
Solution : Rename your array and try again.解决方案:重命名您的阵列并重试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.