getting a runtime error anyone pls hlp!!

#include<stdio.h>
int a[100000],b[100000];
int main()
{
int pos,i;
long n;
while(1)
{
scanf("%ld",&n);
if(n==0)
break;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
pos=a[i];
b[pos-1]=i+1;
}
for(i=0;i<n;i++)
{
if(a[i]!=b[i])
break;
}
if(i==n)
printf(“ambiguous\n”);
else
printf(“not ambiguous\n”);
}
}

Hello,

Simply add return 0; at the end of your main() function, I’m sure your Runtime error will be gone… :slight_smile:

Best regards,

Bruno

1 Like

main method return type is int so use return 0 at the end.

add return 0; at the end of main or make your main of type void