469,578 Members | 1,756 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

2-dimensional array population

GB
Hello,
I have a recursion function which generate 1-dimensional vector of integers
so for 3 cycles I have, for example, following vectors:
int[] vec1 = {1,3,2,4};
int[] vec2 = {2,5,6,2};
int[] vec3 = {3,3,2,8};

I need to populate 2 dimensional array of integers
int[,] st_list ,which is initially is empty, with the content of the vectors
above.
The number of columns in the 2 dim array is same (4) but the number of raw
is unknown.
So I need to populate the 2 dimensional array with each vector one at the
time (recursion iteration).
Could you please give me a hint how to do this?

Thanks,
GB

Aug 29 '06 #1
1 2103
GB wrote:
Hello,
I have a recursion function which generate 1-dimensional vector of integers
so for 3 cycles I have, for example, following vectors:
int[] vec1 = {1,3,2,4};
int[] vec2 = {2,5,6,2};
int[] vec3 = {3,3,2,8};

I need to populate 2 dimensional array of integers
int[,] st_list ,which is initially is empty, with the content of the vectors
above.
The number of columns in the 2 dim array is same (4) but the number of raw
is unknown.
I'm not sure if I understand your question correctly. I think this
doesn't work because once the 2-dimensional array is created, it cannot
be resized anymore.

I'd store the 1-dimensional arrays in a list (which is resizable) and
once your generator function is done you can convert that list to a
2-dimensional array.

hth,
Max
Aug 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by MS | last post: by
46 posts views Thread by RoSsIaCrIiLoIA | last post: by
8 posts views Thread by Relative0 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.