Exporting info from int main(argc, char*argv[])

So I use the following function: int main(argc, char*argv[]).... along with an ifstream to pull data from a txt file and stored it into an a multidimensional array. How do I pass the data from this array to another function?
with multidimentional arrays it's a pain.

See this: http://cplusplus.com/forum/articles/17108/

Along with explaining why you should avoid MD arrays, it also shows you how to use them (pass them between functions)
OK... well I understand the example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
int func2(int p[], int width)
{
  // p[2][3] = 1;         // no good anymore, 1D array
  p[ (2*width) + 3] = 1;  // the 1D apprach to do the same thing

/*  It's worth noting here that the above (y*width)+x calculation is basically what
    MD arrays compile to anyway.  The compiler just hides it from you with MD arrays.
     Or at least it's true with Straight Flavor MD arrays.  Other flavors are more sinister.
*/
}

//...
int evil[4][5];
func2(evil[0],5);  // ugly  


The thing is that their function is: int func2(int p[], int width). My issue is that I'm using int main(argc, char*argv[]) to pull data from a file and storing it in an array. My issue is making this array available for other functions to use. Am I being confusing?
Topic archived. No new replies allowed.