Why not working

#include
#include
using namespace std;
int search(int mat[1000][1000], int r, int no);

int search(int mat[1000][1000], int r, int no)
{
if (r==0)
return -1;

//traverse through the matrix 
for(int i = 0; i < r; i++) 
{ 
	for(int j = 0; j < r; j++) 
	//if the element is found 
	if(mat[i][j]==no) 
	{ 
		cout<<"1"; 
		//return 1; 
	} 
} 

cout <<"0"; 
return 0; 

}

// Driver code
int main()
{
int mat[1000][1000];
int i,j;
int no;
int r,c;
cin>>r>>c;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin>>mat[i][j];
}
}
cin>>no;

int k=search(mat,r,no);
cout<<k;

return 0; 

}

hi @chandeep please share code using cb ide

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.