Subsequence problem

Why is this code returning wrong answer.

#include
using namespace std;

void seq(char *str,char *out,int i,int j){
///base case
if(str[i]==’\0’){
out[j]=’\0’;
cout<<out<<", ";
return;
}

///recursive case
seq(str,out,i+1,j);
out[j]=str[i];
seq(str,out,i+1,j+1);

}

int main(){
char str[1000];cin>>str;
char out[1000];
seq(str,out,0,0);
}

I have edited your code… Also you need to use the same logic for printing the total no of subsequences for a given string value as well.