+ 1
Why does this code outputs '@'?
I try to remove any space or command character from a c-string, I increment the pointer so the array will start from index 1, but it prints @... https://code.sololearn.com/cyC4XdCoQyGZ/?ref=app
8 Respostas
+ 3
I have changed your if statement to be like:
if(*s <= ' ' && *s != '\0')
it should work better now, test it and tell if it works :D
+ 2
Strange problem. I will try to figure it out in the morning (3am here), what can I advise you right now is to make yourself familiar with erase-remove idiom in C++. It can delete spaces easier and faster :D (recursion is really slow)
+ 2
Thanks sir! It's very strange, I called the function twice (with same arguments) and it printed 'PP' ...
+ 1
Thanks, it works :D !
+ 1
I forgot evaluate if I get the end of string :p
+ 1
Now I see the function doesn't modify the array as itself, only a copy... How can I pass an array/pointer by reference?
+ 1
Well, I just wrote s=eval(s) :p
Finally my language can print any string with < :D
< 'Hello World'