Whats wrong with this code ?(smart keypad-I)

#include
using namespace std;

char table[][10] = { " ", “.+@$”, “abc”, “def”, “ghi”, “jkl” , “mno”, “pqrs” , “tuv”, “wxyz” };
void generate_names(char inp,char out,int i,int j){
// base case
if(inp[i]==’\0’){
out[j]=’\0’;
cout<<out<<endl;
return;
}
//recurssive case
int digit=inp[i]-‘0’;
if(digit==0){
generate_names(inp,out,i+1,j);
}

for(int k=0;table[digit][k]!='\0';k++){
	out[j]=table[digit][k];
	
	generate_names(inp,out,i+1,j+1);

}
return;

}
int main(){
char S[1000];
cin>>S;
char output[1000];
generate_names(S,output,0,0);
return 0;
}

hey @vanshit02 please share your code using ide.codingblocks.com , code isn’t readable .

Cmnt out this part and then try to submit

// if(digit==0){
	// 	generate_names(inp,out,i+1,j);
	// }

now its working…can u tell what was wrong in the orignal one?

Test cases are designed without considering this piece of code.

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.