Can't figure out the reason for getting a SiGSEGV run time error

I am unable to determine the cause of the error .
declaring function prototype as :
long long int myfunc(long long int,long long int);
A global array has been declared as :
long long int a[50000];
calling function myfunc() by copying parameters start and end like :
Function Definition :
long long int myfunc(long long int start,long long int end)
long long int x=0;
int i=0;
return 0;
x = x+ a[i];
return x;
By Commenting out the loop in the function I am able to get WC as result but in all other cases its Runtime Error ( SIGSEGV) . The above function is the only place where the array is being accessed. Program working fine on my system ( tested with boundry conditions) !

Reasons of SIGSEGV-


the problem might be with “i” also. try declaring “i” with long long int data type and see if it works.

Yes you are checking that start and end are inside “int” range :). but just try , programs some times behave differently :stuck_out_tongue: .

This is a suggestion not a solution.

I am aware of the reasons for SIGSEGV as can be seen in the FAQ . Just not clear how an array is being accessed out of bound here or how sizeof(a)> 64 M [ where a : long long int a[50000])