4 ms·
This won't work, if the first char of z_terminated == char_to_remove. I have a similar solution farther down the page. Not many people seem to like doing it wi
by what 16y ago
This won't work, if the first char of z_terminated == char_to_remove.
I have a similar solution farther down the page. Not many people seem to like doing it with pointer manipulation.
EDIT: We should both probably add
if(!char_to_remove) return;
at the top since we'll get a seg fault if someone tries to be sneaky and passes the zero-terminator. And then might as well check if z_terminated is NULL while we're at it. Or is there a better way to handle it?
- deleted 16y ago[deleted]