Why do I get a SIGSEGV?

Hello… Am new to CodeChef… And tried one program in beginners… but is showing me Runtime Error(SIGSEGV)… i know that its related to program taking too much memory because of FOR loop… but i don’t know any other way to store that amount of data without FOR loop… so… plz… if Anyone can help with that… MY CODE AT: https://www.codechef.com/viewsolution/15912262

well… figured it out anyway…

Y is this a runtime error??
#include<stdio.h>
#include<conio.h>
int main()
{
int t,n,p,i,j,e,h,s[10];
clrscr();
printf("\nEnter the no. of test cases:");
scanf("%d",&t);
for(i=0;i<t;i++)
{
e=0;
h=0;
printf("\nEnter the no.of problems and no.of people solving 'em:");
scanf("%d%d",&n,&p);
printf(“Enter the no.of people solving the resp problems:”);
for(j=0;j<n;j++)
{
scanf("%d",&s[j]);
if(s[j]>=p/2)
e++;
else if(s[j]<=p/10)
h++;
}
if(e==1&&h==2)
printf("\nYes!");
else
printf("\nNo!");
}
getch();
return 0;
}

why am i getting SIGSEGV in this
https://www.codechef.com/viewsolution/16584427

WHY AM I GOT RE (SIGSEGV)
https://www.codechef.com/viewsolution/21756639

line 22 (sscanf)
should have
&L,&R
instead of
L,R

This will only remove runtime error… it won’t give AC without any other changes :smiley:

Why I am getting a runtime error SIGSEGV in the problem? Where I am going wrong?

#include <stdio.h>
int main(void)
{
int i,j,n,a[100],t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if( a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}

}
for(i=0;i<n;i++)
printf("%d\n",a[i ]);
return 0;

}

Why I am getting a runtime error SIGSEGV in the problem? Where I am going wrong?

#include <stdio.h>
int main(void)
{
int i,j,n,a[100],t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if( a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}

}
for(i=0;i<n;i++)
printf("%d\n",a[i ]);
return 0;

}

Why I am getting a runtime error SIGSEGV in the problem? Where I am going wrong?

#include <stdio.h>
int main(void)
{
int i,j,n,a[100],t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if( a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}

}
for(i=0;i<n;i++)
printf("%d\n",a[i ]);
return 0;

}