Im not able to pass 2d array in function

i have written the logic but im not able to complile the code lots of errors are showing . there is some issue with passing 2d array in function

hey @mdhammad139 please share your code by saving it on ide.codingblocks.com so that i can help you in the better way .

i have shared the code sir…

@mdhammad139 yes i got it .
wait i will go through your code and let you know about your error .

ok sir thanx in advance

hey @mdhammad139 i have corrected your code and now it is not giving any error .


if you have any doubt please let me know .

missed int in function declaration but still same issue unwanted compile errors

hey @mdhammad139 when i try to compile there was no such error .

you are trying to implement matrix staircase search right ?

yes sir i doing staircase problem

have you seen the editorial problem for this question ?

no sir i havent…

there is very easy implementation for this problem like you have to start the searching from a[0][m] and if the given element is greater then this a[0][m] element then you have to simply increment your row and if not then decrement yout column and if the element is found then return indexes or return true .

I didn’t get why it is not compiling

with the implementation the approach also matters for compilation.
could you please explain your approach ?

yes sir I have applied the same logic u mentioned

I have taken an 2d array which stores x and y coordinates of the current position starting from top right corner

hey @mdhammad139 no you are just making comparisons on the basis of pointer[0][0] that also within indexing .
should i give you the correct implementation of the logic i told ?

hey @mdhammad139 try now :


i have made one more correction in your code .