I am not understanding is this function given below is cal by reference or value? Its working like call by reference. But I wonder if I am not passing any address or pointer then why the values are changing in main? Secondly, I would like to know how to write a function If I want the changes made inside a function to an array shouldn't reflect main? (I complied this code on gcc)
void assign(int n, int m, double a[n][m])
{
int i, j;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
a[i][j]=i*10;
}
void main(void)
{
int i,j,m,n;
m=5;n=10;
double a[n][m];
for(i=0;i<n;i++)
for(j=0;j<m;j++)
a[i][j]=i*100;
assign(n,m,a);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
printf("%f ",a[i][j]);
printf("\n");
}
}