Runtime Error(SIGSEGV) Enormous Input Test

Enormous Input Test

what does this error means. I submitted the following program.

#include< iostream>

using namespace std;

main()

{

 int n,k,t[100],i,j=0;

 cin>>n>>k;

 if(k<=10000000)

 {


 
 for(i=0;i<n;i++)

 {

 if(t[i]<1000000000)

  {

  cin>>t[i];

  }

 }

 for(i=0;i<n;i++)

 {
     if(t[i]%k==0)
    
        j++;
    

 }
cout<<j;


}

}
1 Like

According to http://www.codechef.com/wiki/status-codes:

A SIGSEGV is an error(signal) caused by an invalid memory reference or a segmentation fault. You are probably trying to access an array element out of bounds or trying to use too much memory. Some of the other causes of a segmentation fault are : Using uninitialized pointers, dereference of NULL pointers, accessing memory that the program doesn’t own.

Your solution is probably causing a Segmentation Fault.

1 Like

thank you sir

Why are you using t[100] ?