Instead of "enlarging" an array (making a new array that's bigger, and then moving each element over), you should really consider an ArrayList. You might think of an ArrayList as an array that automatically re-sizes itself.
I know that you've asked about ArrayLists in another thread, so I'm curious why you're using an array. Are you required to use an array here? Do you have more questions about using an ArrayList?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
if you don't want to use an arraylist, here's a way for you to get your input into an undetermined-length array.
Don't think it's real efficient, but might suit.
Joined: Dec 05, 2005
@Campbell Ritchie... I took care of this using this(see code):
but thanx anyway.
@marc weber.... thanks for the ArrayList explanation. This is exactly what i was looking for, that notwithstanding i think solving the problem "manually" with Arrays first will help me understand the solution with ArrayLists better(dont u think?)....
@Michael Dunn.... wonderful!...you really helped me there.