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.
You're using
sizeof(s)
for the length of the string; it should bestrlen(s)
.How does this cause the weird behaviour you saw? The value of
sizeof(s)
will always be 8, the number of bytes used to represent a pointer. So your code is always reading 8 characters, regardless of how long the string really is. If the string is shorter than 8 characters, the code reads some of whatever happens to sit after it in memory - which is probably the string for the next test. So by commenting out some tests, you affect the behaviour of your code on other tests.As you can see it's not a problem of the kata... Top of the page: 171 guys passed the C kata out of 1991. It's a CW error. You can report it at CW as a bug.