This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array gotchas

 
Steven Broadbent
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking for any potential gotchas I might have missed.
A couple of points I came across:-

From K & R
int [] x , y ; //defines two arrays of ints
int x [], y; //defines one array of ints and one int primitive
K and R states that if [] follows the type then all variables in the declaration are arrays. Otherwise the [] must follow each array name in the declaration.
From Dan's exam:-
int []a3,[]a4;
does not compile, because the [] must be placed after the type or identifier.

None of these seem to be covered in S & B. Am I just getting pre-exam jitters or what?
 
Tom Purl
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't sweat this type of stuff too much. The exam's purpose isn't to give you every possible permutation of an array declaration to see if you have a java compiler built into your brain. The exam is a good test of your array knowledge, but it doesn't do this by using gimmicky questions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic