initialiser list

Discussion in 'C++' started by Fraser Ross, Dec 24, 2010.

  1. Fraser Ross

    Fraser Ross Guest

    Can someone explain why there is an error "} expected" for this?

    char MyArray1[2] = { "a"[0], 'b' };

    Fraser.
    Fraser Ross, Dec 24, 2010
    #1
    1. Advertising

  2. Fraser Ross

    Fraser Ross Guest

    "Fraser Ross"
    > Can someone explain why there is an error "} expected" for this?
    >
    > char MyArray1[2] = { "a"[0], 'b' };
    >
    > Fraser.



    I see what there is now. There isn't list-initialisation. The char
    array is seen to be initialised from the array "a". The braces are
    irrelevant.

    Fraser.
    Fraser Ross, Dec 24, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Harrison
    Replies:
    2
    Views:
    1,262
    =?iso-8859-1?Q?Juli=E1n?= Albo
    Jun 25, 2003
  2. Martin Zimmermann
    Replies:
    2
    Views:
    484
    Rob Williscroft
    Apr 14, 2004
  3. Mike Hewson
    Replies:
    14
    Views:
    11,887
    Micah Cowan
    Jan 7, 2005
  4. Glen Able

    Reference + initialiser oddity.

    Glen Able, Jan 28, 2005, in forum: C++
    Replies:
    3
    Views:
    363
    Ioannis Vranos
    Jan 29, 2005
  5. kwikius
    Replies:
    11
    Views:
    529
    kwikius
    Jul 11, 2008
Loading...

Share This Page