小编Kri*_*rii的帖子

变量在切换情况下不起作用

当我尝试编译以下内容时:

bool matrix[h][w];

bool c = 0;
switch(1) // was close?
{
  case matrix[y][x-1]: // up 1
  case matrix[y-2][x-1]: // down 1
  case matrix[y-1][x]: // right 1
  case matrix[y][x-2]: // left 1
    c = 1;
    break;
}
Run Code Online (Sandbox Code Playgroud)

它回来了the value of 'matrix' is not usable in a constant expression.我究竟做错了什么?

c++ arrays boolean

-4
推荐指数
1
解决办法
82
查看次数

标签 统计

arrays ×1

boolean ×1

c++ ×1