Wrong output, this is not working as soon as i encounter x, it is only pronting values before first x
how to correct it, can you please edit my code?
while (a[j] != '\0'){
j++;
}
a[j+1]='\0';
a[j]='x';
for ( int k=i;k<=j;k++){
a[k]=a[k+1];
}
this is also giving segmentation fault . why?
Consider a case where all elements are x your code wwill stuck in infinite cycle
then how should i write the code? please edit my program.
first move all x that are in right to the end and then move current x to the end or before x.
check this-
this code is giving segmentation fault
This won’t work s[0]
, this will always means first index of a, and it won’t get updated too. Try to implement like this
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.