allocate array elements one at a time?
Is there a way to allocate array elements one at a time?
The following code will crash because the minimumLogIndices array is not allocated.
// get all indices where cArray[i] > minimumLog
int[] minimumLogIndices =null;
for (int i=0; i < columns; i++)
{
if ((cArray[i] > minimumLog))
{
minimumLogIndices[i] = i;
}
}
I would like a statement like:
minimumLogIndices[i] =new(i);
but this is not allowed, of course.
If I use ArrayList, then the elements can be added one at a time, but I cannot use int.
null

