Getting segmentation fault

can you please check what is wrong with my code

You have not written the base case of ur recursive function. That is why, giving segmentation error