PC Review


Reply
Thread Tools Rate Thread

2-dimensional array population

 
 
GB
Guest
Posts: n/a
 
      29th Aug 2006
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





 
Reply With Quote
 
 
 
 
Markus Stoeger
Guest
Posts: n/a
 
      29th Aug 2006
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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export 1-dimensional array values to a two-dimensional table? =?Utf-8?B?TGF1cmll?= Microsoft Excel Programming 2 8th Nov 2007 03:51 PM
Extracting single dimensional array out of two dimensional array Mukesh Microsoft C# .NET 5 24th Oct 2007 11:22 PM
flatten multi-dimensional array to on-dimensional array per9000 Microsoft C# .NET 8 4th Dec 2006 09:46 AM
copy 1 dimensional to 2 dimensional array with actual int values j-in-uk Microsoft C# .NET 3 12th May 2006 09:23 AM
RE: array copy from single-dimensional to multi-dimensional =?Utf-8?B?bWFyaw==?= Microsoft VB .NET 0 30th Jul 2004 11:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:32 PM.