Original Post
Hi all,
I''m new here, and was wondering if someone might be able to help me with a couple of things. I just can''t get my head around it, not for lack of trying. Anyways, I basically have two questions:
1) How do I go about initializing a multi-dimensional array with a bunch of data if I don''t know before hand the number of rows or columns? For instance, I am trying to initialize a percents[][] array with a number of groups of percentages. For example:
{0.2, 3.1, 4.8, 5.4};
{2.3, 2.8, 4.3};
Is it possible to do this dynamically, or do I have to declare the number of columns before hand, like percents[][1]?
2) If I have a multi-dimensional array that is seeded with values now, like let''s say percents[2][5], how would I use the sizeof function to return: number of rows (3), and number of columns per row? Basically I want to iterate through the percent rows, and then find the number of items for each column. So first I would need to find the total number of columns to set up my first loop, and then find the number of columns per row as I go through the loop. Any suggestions?
Sorry for the long message, hoping someone can help me out. Thanks,
Dave