Why do I get a SIGSEGV?

faq
rte
sigsegv

#1

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


#2

This is an error caused by an invalid memory reference or segmentation fault. The most common causes are accessing an array element out of bounds, or using too much memory.

Some things for you to try:

Make sure you aren’t using variables that haven’t been initialised. These may be set to 0 on your computer, but aren’t guaranteed to be on the judge.

Check every single occurrence of accessing an array element and see if it could possibly be out of bounds.

Make sure you aren’t declaring too much memory. 64 MB is guaranteed, but having an array of size [10000][10000] will never work.

Make sure you aren’t declaring too much stack memory. Any large arrays should be declared globally, outside of any functions - putting an array of 100000 ints inside a function probably won’t work.


#3

//why i was getting SIGSEGV??
//for this question http://www.codechef.com/COQU2014/problems/DCQ1402
//please help n explain

for this solution http://www.codechef.com/viewsolution/5277974


#4

why do i get SIGSEV for the problem http://www.codechef.com/KAN14ROL/problems/ACM14KN3/


#5

solution is http://www.codechef.com/viewsolution/5456719


#6

why am i getting sigsev for the solution at http://www.codechef.com/viewsolution/5601458


#7

can anyone help m why m getting SIGSEGV RUNTIME ERROR http://www.codechef.com/viewsolution/5940071


#8

why di i get reutime error for given problem
#include<stdio.h>
#include<stdlib.h>
#define size 65535
int main()
{
long n,k,j,t[size],i=0,count=0;
scanf("%ld %ld",&n,&k);
while(i<n)
{
scanf("%ld",&t*);
printf("
“);
if(t*%k==0)
count++;
i++;
}
printf(”%ld
",count);
}


#9

please help why do i get sigsegv in this code http://www.codechef.com/viewsolution/5988352


#10

why do i get SIGSEVG


#11

why am i getting SIGSEVG ?
http://www.codechef.com/viewsolution/6144778
plz help


#12

why am i getting SIGEVG?http://www.codechef.com/viewsolution/6153699
please help


#13

can anyone help me…why i am getting SIGSEVG error in this http://ideone.com/PeQwg9
thanks in advance


#14

can anyone help me…why i am getting SIGSEVG error in this http://ideone.com/PeQwg9
thanks in advance


#15

#include<stdio.h>
main()
{
long long t=0,i=0,j=0,temp=0,a[10000];
scanf("%lld",&t);
for(i=0;i<t;i++)
scanf("%lld",&a*);

for(i=0;i<t-1;i++)
{
	for(j=0;j<t-1;j++)
	{
		if(a[j]>a[j+1])
        {
        temp=a[j];
		a[j]=a[j+1];
		a[j+1]=temp;
	    }
   }
}
for(i=0;i<t;i++)
  printf("%lld

",a*);
}


#16

why am i getting SIGSEVG ? http://www.codechef.com/viewsolution/6368752 plzzzzz help me!! Thank U…


#17

A segfault basically means you did something bad with pointers. This is probably a segfault:

char *c = NULL;

*c; // dereferencing a NULL pointer
Or this:

char *c = “Hello”;

c[10] = ‘z’; // out of bounds, or in this case, writing into read-only memory
Or maybe this:

char *c = new char[10];

delete [] c;

c[2] = ‘z’; // accessing freed memory
Same basic principle in each case - you’re doing something with memory that isn’t yours.


#18

Hi Folks,
Check out the latest Coding jobs :- http://jobsiit.com/jobs/listing/Computer%20Science


#19

Adobe Systems is hiring Software Engineers
CTC:- 8-30 Lac, Exp:- 0-8 Years, Bangalore

Apply Here:- http://jobsiit.com/jobs/view/1876/Adobe-Systems/Software-Engineer


#20

Why do I get SIGSEGV error for this code http://www.codechef.com/viewsolution/6382701