I got it you're here just doing for example 'abcde' to 'abade' i.e replacing c by a. If you want to eliminate c from there you have to use loop such that when 'c' is detected (as in your code in 'if' condition) you apply a loop till the end of string such that loop copies that element(e.g. 'd') which is coming after the 'c' to the cth place and copies element after 'd' i.e. e to dth place and so on. This will definitely shrink your string. I guess i have given you the logic. Rest depends upon you. Good luck
char strs = "abcdfe";
auto end = std::remove(strs, strs + sizeof(strs), 'c');
for(auto it = strs; it != end; ++it)
Bjarne(the father of c++) recommendation
Don't use C coding standards (even if slightly modified for C++) and don't use ten-year-old C++ coding standards (even if good for their time). C++ isn't (just) C and Standard C++ is not (just) pre-standard C++.