0
ex: suppose a string called "Gustavo". How I make a pointer point to each position of the string and go applying the following rule.
- If the pointer finds the vowel A, the contents of that pointer shall receive "AUAU"
- If the pointer meets the vowel U, the contents of that pointer shall receive "AUAUAUAUAU"
at the end the contents of the pointer thus: Gauauauauaustauauauauvo
NOTE: I don’t want to modify the original string but use it as a basis for can apply the above rules by storing them in the contents of my pointer.
I believe that you cannot point to the resulting string with this pointer without using an auxiliary variable, unless you were changing the string itself that is being checked. But it would be good for you to show what you’ve tried.
– g-otn
To do such a substitution you have to copy to the resulting string or each read character that does not need to be replaced or the substitute string. You will have to allocate memory to the resulting string. What you can do is reallocate each character(s) to the string.
– anonimo
https://ideone.com/r4V9ro
– pmg