Why this code is not working getting segmentation fault

Source code https://ide.codingblocks.com/s/230115

modified code

you have to add one condition
if(start==end) return temp;

Everything is same but still getting error please help https://ide.codingblocks.com/s/232353

in your code
for(int j=start;j<end;j++)
this is wrong you have to write
for(int j=start;j<=end;j++)

main mistake is that first arr is pre[] not in[]