Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
your code does not handle these edge cases safely: empty string (
""
) and string consisting entirely of exclamation marks ("!!!"
). these inputs make your code go out-of-bounds ofstr_in
, towards the left (negative indices). hence the crash.it is also incorrect because you do not nul-terminate at the right index:
this cannot be right, since
str_out
will be shorter thanstr_in
in generalhttps://docs.codewars.com/training/troubleshooting#print-input
you can use
printf
to see which values you get and which you returnYou did not null-terminate the
masked
at all.