What is the error

#include
#include
using namespace std;
int main() {

int i=0;
int j=0;
int k=0;
int n;
cin>>n;
int a[n],b[n];
int c[2*n];
for(int i=0;i<n;i++){
	cin>>a[i];
}
for(int i=0;i<n;i++){
	cin>>b[i];
}
while(i < n && j < n){
	if(a[i]<b[j]){
		c[k]=a[i];
		i++;
	}
	else
	{
		c[k]=b[j];
		j++;
	}
	k++;
}
while(i<n){
	c[k]=a[i];
	k++;
	i++;
}
while(j<n){
	c[k]=b[j];
	k++;
	j++;
}
int mid=k/2;
return c[mid];

}
unable to get the error

here’s the updated code : https://ide.codingblocks.com/s/211694

Hi @mayank10

Instead of return, you need to write cout << c[mid];

Also define mid as k/2-1 because k is always even and hence there will be two middle elements.So we need to print the first middle element.

Hope it Helps.

@mayank10
Please mark your doubt as resolved.

Hey @Nayan04
I see you have reopened this doubt
How can I help you ?

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.

@mayank10
You’re opening this doubt for the second time without sending your query buddy ?
Is there a glitch or something then please let me know