What is this array declaration?

After solving a practical question, I always look at Red Coder's solution. I saw an array declaration today that I have never seen before. He declared an array something like this

 char a['  '],b['  '];

      

Please let me know what it is?

PS. This may be a recurring question. I actually searched for it but couldn't find anything about it (maybe because I didn't know what to look for), if it is a duplicate please close the question and give me a link.

+3


source to share


1 answer


Single quotes are a character constant.

  • ' '

    can be a space that 32

    is ASCII.
  • ' '

    can be an embedded TAB character, which is 9

    ASCII
  • ' '

    can be two spaces to be implementation specific int

    .


In any case, you can specify any expression that is an integer type (or convertible to one) inside []

an array declaration. So you get sizeof a

32

either 9

or the implementation-defined value.

+5


source







All Articles