Link to home
Start Free TrialLog in
Avatar of jmkotman
jmkotmanFlag for United States of America

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,
Avatar of Raymun
Raymun

Use a vector
or arraylist
Avatar of jmkotman

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.
ASKER CERTIFIED SOLUTION
Avatar of Ravi Singh
Ravi Singh
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial