Passing an Array of unassigned size into a function

What I'm trying to do is get a function that can accept an array of an unassinged value into it. Something like as follows;
1
2
3
4
5
6
7
8
9
10
11
12
13
func1(){
   int array1[3];
   // code to fill array
   mainFunction(array1);
}
func2(){
   int array2[9];
   // code to fill array
   mainFunction(array2);
}
mainFunction(int arrayIN[]){
   // rest of code
}

I've tried pointers plus many other ideas from google but none of them will work. Anyone have any idea? Thanks in advance.
Last edited on
Pass the size?
This kind of question has become surprisingly common lately.
See http://www.cplusplus.com/forum/general/49079/#msg266703 for more.
Lately? It's just below "why does the console keep closing?" and just above "undefined reference to <a template function>" on the list of common questions.
Last edited on
Thanks Duoas, that worked a treat!
Topic archived. No new replies allowed.