I am getting segmentation fault in this code and i am not able to figure out the reason.
#include
using namespace std;
void subset(int input[],int output[],int i,int j,int n){
//base case
if(i == n){
int sum=0;
for(int k=0;k<j;k++){
sum=sum+output[k];
}
if(sum==0){
cout<<“Yes”;
}else {
cout<<“No”;
}
return ;
}
//recursive case
subset(input,output,i+1,j,n);
output[j]=input[i];
subset(input,output,i+1,j+1,n);
}
int main() {
int n;
int input[100];
for(int i=0;i<n;i++){
cin>>input[i];
}
int output[100];
subset(input,output,0,0,n);
}