title: How is an array type declaration 'new int[10][]' evaluated?
body: <p>a) How is an array type declaration <code>new int[10][]</code> evaluated? Is it evaluated</p>
  <p>as <code>(new int[10])[] </code></p>
  <p>or as <code>(new int[10][])</code></p>
  <p>or …?</p>
  <p>b) I’m not sure how to ask this: I know statement <code>int[][] i = (new int[10])[]</code> would give us compiler error. But assuming compiler wouldn’t report an error, what kind of array type would compiler create based on this statement?</p>
  <br>
  <p>EDITED:</p>
  <p>I apologize for not being able to make my question more comprehensive. It’s one of those questions where something is bothering me and I’m not capable of crystallizing the question in my mind enough to make some sense of it. So I ask a half assed questions hoping that replies will help me with that.  Anyways, it’s a pointless question but I would still like to explain what I’ve actually meant by it:</p>
  <p>what prompted all of this was an article from MSDN where it said</p>
  <blockquote>
  <p>Primary expressions are divided between array-creation-expressions and primary-no-array-creation-expressions. Treating array-creation-expression in this way, rather than listing it along with the other simple expression forms, enables the grammar to disallow potentially confusing code such as</p>
  <p>object o = new int[3][1];</p>
  <p>which would otherwise be interpreted as</p>
  <p>object o = (new int[3])[1];</p>
  </blockquote>
  <p>so that got me thinking that perhaps parenthesis around different parts of this array creation expression would give compiler different instructions on the type of array it should create.</p>
  <p>Or to put it differently, I thought that perhaps compiler follows some build-in logic ( derived from some math field ) when interpreting array creation/initialization syntax. In other words, compiler didn’t build an array due to its developers giving it specific instruction such as “<em>when you see words <strong>new</strong> and <strong>name of some type</strong> and <strong>two pairs of square brackets ([] [])</strong>, then follow these step-by-step instructions , which will tell you in full details what to do</em>&quot;, but instead developers just build in some math related logic and from that compiler was capable deriving an array by itself, without developers giving it step by step instructions.</p>
  <p>BTW – I do understand about jagged and rectangular arrays and how they are initialized etc ;)</p>