If you can give your submission link, I can have a better look over the code. 
Somebody please help me with this solution. It works on my machine.
But gives a SIGSEGV error here.
P.S. My compiler is in compliance with C99.
How to improvise in my code so as to remove SIGSEVG? Please check in this link CodeChef: Practical coding for everyone
Please tell me why am I getting SIGSEGV error for this beginner problem of Malvika’s Fibonacci series. View my solution link text
I am Getting SIG SEVG error for this solution
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int trim(char*);
int main(int argc, char** argv) {
int test_Cases, i = 0;
char input[10];
scanf("%d", &test_Cases);
while(i < test_Cases) {
scanf("%s", input);
if(trim(input) == 1)
puts("yes");
else
puts("no");
i++;
}
return 0;
}
int trim(char* s) {
int i =0, j = 0;
while(*(s+i) != '\0') {
if(toupper(*(s+i)) == 'C' || toupper(*(s+i)) == 'S' || toupper(*(s+i)) == 'E') {
*(s+j) = *(s+i);
j++;
}
i++;
}
*(s+j) = '\0';
i = 0;
while(i < strlen(s) - 1) {
if(s[i] > s[i+1])
return 0;
i++;
}
return 1;
}
Can you tell me why ?
Hi. Please help me with understanding the SIGSEGV error here. Read the thread and some articles, still could not get the issue with the code.
Question: SIMDISH Problem - CodeChef
My solution: CodeChef: Practical coding for everyone
A similar accepted solution:CodeChef: Practical coding for everyone
My solution compiles, runs and gives me the correct answer in cmd compiler, but shows the run time error in codechef
https://www.codechef.com/viewsolution/14108863
can anybody pls tell,why am i getting sigsegv error here?it would be a great help.
Question : https://www.codechef.com/JUNE17/problems/CLONEMEa
THnaks
hello everyone, I have recently shifted from C to C++, can someone please tell me why I’m getting sigsegv despite, it runs fine on Dev C++ ide.
Please tell me which should I choose C++(4.9.2),(4.3.2) or 14.
Can anyone help me why I am getting sigsegv error here?
Question: https://www.codechef.com/problems/HORSES
My solution: link text
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: CodeChef: Practical coding for everyone
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 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;
}
because you are initializing array a of size 5 , whereas n can be very large , so you are trying to access invalid memory hence SIGSEGV