• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array Declaration Doubt

 
Jayant Raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Please refer to the following code :



Q. Why is there a compile time exception at 2 ?
Q. Is a5 a 1-D array & a6 a 2-D array ?
 
Sebastien Col
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Q. Why is there a compile time exception at 2 ?
R. Because of the [] that is before the a4 identifier. The first part of the line says that you're declaring int arrays, the first one being named "a3". Then, after the coma, you must have only identifiers, as following:

int []a3, a4;

Q. Is a5 a 1-D array & a6 a 2-D array ?
R. Yes. a5 is an int[], and a6 is an array of int[].

Sebastien.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic