Hello ,
The following function takes a number x and returns the sum of all numbers before n.
For ex. when x = 5 the function should return 4+3+2+1.
unsigned long long rep(int x)
{
if(x==1)return 1;
return x + (rep(x-1)%314159);
}
I'm getting a segmentation fault with the above code when i pass 1,000,000 as a parameter to the function "rep".
Any help would be greatly appreciated , Thanks in advanced.