Considering I have the following array:
int * a = new int[1000];
I would like to pass this array to a function by reference. If I would be calling this function from main
:
int main()
{
int * a = new int[1000];
func(a);
//print the elements of the array
for(int i=1;i<=sizeof(a);i++) cout<<a[i]<<" ";
return 0;
}
My function would be:
void func( ??? )
{
//write some elements in the array
for(int i=1;i<=sizeof(a);i++) a[i]=i;
}
How do I have to declare func
?