chota bheem
chota bheem

Reputation: 411

What kind of array declaration is this?

After solving practice question,i always look Red Coder's solution.Today i saw an array declaration that i have never seen before. He declared array something like this

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

Please let me know what is it ?

P.S- This can be duplicate question.I actually tried searching it but could not find anything about it(possibly because i didn't know what to look for),if it is a duplicate please close the question and give me a link.

Upvotes: 3

Views: 63

Answers (1)

M.M
M.M

Reputation: 141554

Single quotes are a character constant.

  • ' ' could be a space, which is 32 in ASCII.
  • ' ' could be an embedded TAB character which is 9 in ASCII
  • ' ' could be two spaces, which would be an implementation-defined int value.

In any case, you can supply any expression that is an integer type (or convertible to one) inside the [] of an array declaration. So you will end up with sizeof a being 32, or 9, or implementation-defined value.

Upvotes: 5

Related Questions