when i am trying to run this code for input 1 and 1000 it shows me segmentation fault .what will be the correction in this code ?
void sorting(int sum[],long int
The segmentation fault is caused by stack overflow. This line:
int sum[100000];
sum uses 400K spaces of stack, which is bigger than the normal size of stack.
sum
To fix the problem, you can use std::vector to implement sum instead.
std::vector