#include
#include
using namespace std;
int j=0;
void replace(char a[],char b[],int n,int i){
if(i==n){
cout<<b; }
if(a[i]!=‘x’){
b[j]=a[i];
j++;
}
replace(a,b,n,i+1);
}
int main(){
char a[100],b[100];
cin>>a;
int n=strlen(a);
replace(a,b,n,0);
int n2=strlen(b);
if(n2!=n){
cout<<‘x’;
n2++;
}
}
whats wrong in this code?
Move all x to end
@tishya_goyal possible size of array ranges from 1 to 1000, and you are creating array of size 100 only.
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.