Hacker News new | past | comments | ask | show | jobs | submit login

For question 7, can someone confirm that

  int a[][3] = {1, 2, 3, 4, 5, 6};
is not a typo and is, in fact, a valid array initialization? I've never come across this and think it's rather unintuitive.



It's valid (see C99 6.7.8 §20 and §22) and equivalent to

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


Checking the rules for array initialization in Harbison & Steele, this does indeed seem to be invalid. I'm surprised, I actually thought that was valid...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: