search

Home  >  Q&A  >  body text

C++二维数组问题

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

迷茫迷茫2770 days ago364

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 11:50:38

    The subject of the question can be written like this:

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

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 11:50:38

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

    reply
    0
  • Cancelreply