Why is it showing sigsegv error?

 #include<stdio.h>
    int main()
    {
    	int n=0,k=0,p=0,ti[100],count=0;
    	scanf("%d%d",&n,&k);
    	p=n;
    	while(n>0)
    	{
    		scanf("%d",&ti[p-n]);
    		--n;
    	}
    	n=0;
    	while(n<p)
    	{
    		if(ti[n]%k==0)
    		++count;
    		++n;
    	}
    	printf("%d",count);
    return 0;
    }

β€˜ti[100]’. When n > 100 it will give sigsegv error.

2 Likes

still after changing the array size to ti[100000] it is showing error.

n <= 10^7. Also declare the array globally.