Maison  >  Questions et réponses  >  le corps du texte

C++二维数组问题

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

迷茫迷茫2720 Il y a quelques jours322

répondre à tous(2)je répondrai

  • PHPz

    PHPz2017-04-17 11:50:38

    题主可以写成这样:

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

    répondre
    0
  • ringa_lee

    ringa_lee2017-04-17 11:50:38

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

    répondre
    0
  • Annulerrépondre