passing 2d array into functions by ref

vgoel38 (113)
http://ideone.com/anGLHs

m not able to correct the mistakes in passing array by reference to a func.
plz help!
vgoel38 (113)
just see the errors..no need to seet he whole code
LowestOne (767)
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
vgoel38 (113)
still i hv an error http://ideone.com/anGLHs
guestgulkan (2830)
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
vgoel38 (113)
thnx
Registered users can post here. Sign in or register to post.