Array between functions

Hi,
Does anyone knows how to pass an array (one dimensional) between two or more functions?
Please, what I want that program do doesn't matter at all. I don't need "other ways" of doing what I need. Just need to know how to pass one dimensional array between functions (more than one) by reference, when all function can change the content of the array, without having to return the value changed.
Thank you!
See the simple and nonsense example below: how to pass round?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
bool function1(int round) // maybe function1(int* round) or function1(int *&round) or ???
{
      round[0] = 3;
      function2(round);
      return true;
}

bool function2(int round)
{
      round[3] = 10;
      function3(round);
      return true;
}


bool function3(int round)
{
      round[5] = 1000;
      return true;
}

void main(void)
{
   int* round;
   round = new int[10000];
   bool done;
   done = function1(round);
   done = function3(round);
}

Last edited on
Remember that the name of the array can be used as a pointer to the first element of the array. So, in this case, the argument should be a pointer to int.
Topic archived. No new replies allowed.