jmkotman
asked on
Arrays C#
If i want to fill an array with numbers, but im not sure what the size is until i run the program how do i make an array adjustable? I assume you would need to put it in some kind of for loop,
Use a vector
or arraylist
ASKER
If i read in a list of numbers i would usually do this
static int[] array = new int[10];
for(int i=0; i<split.Length; i++)
{
array[i] = int.Parse(split[i]);
}
ok so thats going to put them in the array. Now when i go to sort that array using a bubble sort if the numbers which were read in didn't fill the whole array i get "0" when i sort it and it messes the sort up.
static int[] array = new int[10];
for(int i=0; i<split.Length; i++)
{
array[i] = int.Parse(split[i]);
}
ok so thats going to put them in the array. Now when i go to sort that array using a bubble sort if the numbers which were read in didn't fill the whole array i get "0" when i sort it and it messes the sort up.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.