I am trying to change assign the pointer "c" to the pointer "a" below using the function "change()", but I am doing something incorrectly, not exactly sure. The direct assignment within the main() function works (ie a = c), but does not work using the change function.
void change(float (*d)[3], float (*e)[3]){
d = e;
}
main(){
float (*a)[3], (*b)[3], c[3][3];
int i, j;
for(i = 0; i < 3; i++){
for(j = 0; j < 3; j++){
c[i][j] = 5;
}
}
//a = c
change(a, c);
for(i = 0; i < 3; i++){
for(j = 0; j < 3; j++){
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}
Thanks.
-Sam