Segmentation fault

segmentation fault coming, i am unable to find the place where i have allotted more space then the size

HI @akshatkaush im a bit lost can you explain your approach a little?

my original array’s pointer is ptr, i’m comparing its value against the parameter value and then if true storing the index in a new array represented by rptr. As the question said to return an array im storing using a new array rather than printing the incex directly below the condition.

@akshatkaush in the base case, the find function returns NULL, which gets assigned to rptr. after that you are trying to access rptr + 1 which gives segmentation fault. I hope you understand the problem.

yeah, i got it, thank you

@akshatkaush please mark the doubt as resolved :slight_smile: