I am coding a program with the help of recursive calling of a function, I get correct output till my test input gets solved within 10 steps of recursion but if I increase the input value to 11 it starts giving run time error as: Segmentation fault (core dumped)
the code snippet of the function is:
void find(int x) {
if(ctr==n-1) {
po[k]=x;
k++;
ctr--;
return;
} else {
ctr++;
find(x+a);
ctr++;
find(x+b);
ctr--;
return;
}
}
ctr, n, k, a & bdeclared and initialized?