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.
This comment is hidden because it contains spoiler information about the solution
Your answer is in this paragraph of FAQ: https://docs.codewars.com/training/troubleshooting#c-c-signal-11---sigsegv
It's not exactly your solution segfaulting, but it causes tests to crash.
This comment is hidden because it contains spoiler information about the solution
But it doesn't. That code is inside the condition
if (*p == ' ' || *p == '\0')
Yes. p is the space or null terminator, so that
p-1
is the last char of the previous word.Hi, could you tell me what the line
*q++ = *(p - 1 - i)
is doing? I don't understand why you are subtracting 1 and i from p on each iteration of the for loop, seeing as p points to the beginning of text. Shouldn't p point to the end of each word, and then as you work backwards, assigning characters to q, q is built?
Thanks in advance.