Whats wrong with this code (subsequence using recursion)

#include
using namespace std;

void generate_subsequence(char *input,char *output,int i,int j,int &count){
// base case
if(input[i]==’\0’){
output[j]=’\0’;
cout<<output<<" ";
count++;
return;
}
//recurssiv case
//including the current character
output[j]=input[i];
generate_subsequence(input,output,i+1,j+1,count);

//excluding the current character
generate_subsequence(input,output,i+1,j,count);
return;

}
int main() {
char s[10000];
cin>>s;
char out[10000];
int count=0;
generate_subsequence(s,out,0,0,count);
cout<<endl;
cout<<count;

}

Hi Vanshit…

Look at this code. Hope it clears all ur doubts.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.