If I have two while loops nested, the inner one should have the precedence compared to the outer one, is that correct?
Because when I am trying to run this program that should match every char of a word in the free store to another one always in the heap, it runs only for first letter "B" then it returns me 0. I have tried to modify the two loops but without success. Can you help me please?
Thanks for reply coder777. It is part of an exercise where I have to build a function that works without the help of any other existing function of the standard library or any other kind of help. How could I fix it?
In your code your output statement always executes once at the end of the function and always writes first letter of character array x.
It is actually iterates fully, but there is another bug here:
what is the value of count_x when inner loop finishes (after line 17)? What happens next? Try to reason what happens step-by-step noting values of each variable after each line.