Possible Duplicate:
What is useful about a reference-to-array parameter?
How do I use arrays in C++?
I am trying to pass the arrays by reference. The problem is I am getting errors for passing these arrays.
error C2664: 'InitializeArrays' : cannot convert parameter 1 from 'int [64]' to 'int (&)[]'
Here is the code:
void InitializeS(int (&s)[], int (&BeforeDecimal1)[]);
int main()
{
int BeforeDecimal[128],s[128];
InitializeS(s,BeforeDecimal);
return 0;
}
void InitializeS(int (&s)[], int (&BeforeDecimal1)[])
{
for(int i=0;i<128;i++)
{
s[i]=0;
BeforeDecimal1[i]=0;
}
}
What am I doing wrong?