Rumah  >  Soal Jawab  >  teks badan

C++二维数组问题

int a[][2]={1,{3,4},5};
书上说这个是错的 请问错在哪啊。。
我用codeBlocks编译之后 报错
error: braces around scalar initializer for type 'int'|

迷茫迷茫2721 hari yang lalu324

membalas semua(2)saya akan balas

  • PHPz

    PHPz2017-04-17 11:50:38

    题主可以写成这样:

    int a [][2] = {
        {1},
        {3, 4},
        {6}
    }
    

    balas
    0
  • ringa_lee

    ringa_lee2017-04-17 11:50:38

    int a[][2]={{3},{3,4},{6}}

    balas
    0
  • Batalbalas