H
hyena
Hi,
I have a problem regarding passin 2 dimensional array into a function.
I have a[][] to pass into function f(), f is called many times and the size
of a[][] will change for each call.
I am not interested in vector implementation in std library since speed is
my major concern.
the follwoing code does not work of couse, it show the idea what I want. The
compiler comlained about lacking at least the 2nd dimnesion length.
void f(int a[][]){
for(i)for(j){
...a[j]
}
}
main(){
int nrow=5,ncol=4;
int a[nrow][ncol];
....//fill in a
f(a);
......
nrow = ..,ncol =...
f(a);
}
in such case, what would be the solution, thanks.
I have a problem regarding passin 2 dimensional array into a function.
I have a[][] to pass into function f(), f is called many times and the size
of a[][] will change for each call.
I am not interested in vector implementation in std library since speed is
my major concern.
the follwoing code does not work of couse, it show the idea what I want. The
compiler comlained about lacking at least the 2nd dimnesion length.
void f(int a[][]){
for(i)for(j){
...a[j]
}
}
main(){
int nrow=5,ncol=4;
int a[nrow][ncol];
....//fill in a
f(a);
......
nrow = ..,ncol =...
f(a);
}
in such case, what would be the solution, thanks.