Ad
  • Custom User Avatar
  • Default User Avatar

    You're using sizeof(s) for the length of the string; it should be strlen(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.

  • Default User Avatar

    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.