Smart keyboard easy

#include
#include
using namespace std;

char keypad[][10] = { " ", “.+@$”, “abc”, “def”, “ghi”, “jkl” , “mno”, “pqrs” , “tuv”, “wxyz” };

void print(char* in , char* out, int i, int j)

{

/// base case
if(in[i]==’\0’)
{
out[j]==’\0’;
cout<<out<<endl;
return;
}

 /// rec case
 int digit=in[i]-'0';
// if( digit==0)
 //{
  //   print(in,out,i+1,j);
 //}

 for(int k=0;keypad[digit][k]!='\0';k++)
 {
     out[j]= keypad[digit][k];
     print(in ,out, i+1, j+1);
 }

}

int main()
{
char in[11];
char out[11]={0};
cin>>in;
print(in,out,0,0);
return 0;

}

i cant understand how this code works . explain please
the how recursion is working here

Save your code on ide.codingblocks.com and then share its link.

The recursive relation for phone keypad question has been discussed in the lecture video. You can refer that first. Also line 17-20 is not required here because when you get a 0, you do not have to skip but introduce a white space.

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.