passing 2d array into functions by ref

http://ideone.com/anGLHs

m not able to correct the mistakes in passing array by reference to a func.
plz help!
just see the errors..no need to seet he whole code
int findmin(int **arr,int rlow,int rhigh, int clow, int chigh)

Not sure about those other errors, perhaps you should use unsigned int for your array subscripts
Last edited on
still i hv an error http://ideone.com/anGLHs
For an array declaredas int arr [51][51] - then arr in pointer terms is
int (*arr)[51]

NOT
int *arr or int **arr

So your function parameters could be written as
1
2
int findmin(int (*arr) [51],int rlow,int rhigh, int clow, int chigh)
 int deletearr(int (*arr)[51],int rlow,int rhigh,int clow,int chigh,int a,int b,int atotal, int btotal)


OR

Of course you could have written it the easier way of:
1
2
int findmin(int arr [] [51],int rlow,int rhigh, int clow, int chigh)
 int deletearr(int arr[][51],int rlow,int rhigh,int clow,int chigh,int a,int b,int atotal, int btotal)



There is an article in the articles section about arrays and pointer equivalence.
Last edited on
thnx
Topic archived. No new replies allowed.