Ad
  • Custom User Avatar

    A quick update: when I used calloc instead of malloc, it worked! I legitimately have no idea why though.

  • Custom User Avatar

    Doing this in C, for some reason, certain test cases will work in my REPL, but not in the Kata. When I type the exact same input into my REPL (online development environment), I get the right answers, but in testing, I don't. I'm almost positive I did this right but I'm not sure how to fix this.

    For example, I get this error:

    step. Error. Expected
    103, 107
    but got
    0, 0

    However, in my REPL I get the correct answer (103 and 107).

    Here's another weird thing: if I comment out one of the test cases I can see (such as dotest(4,100,110, "103, 107");), it will "pass all sample tests," and then when I try to attempt, it will fail a test that I passed before. For example, in the sample tests, it will pass dotest(2,100,110, "101, 103");. However, when I try to "attempt", it will fail on the same test (I know because my program writes a line saying what the input is). Why does this happen? I really like this kata and spent a decent amount of time coming up with a good solution, but I feel like I'm getting screwed on bugged test cases.

    Edit again: I tried it on a real C compiler (gcc) and it worked on there too. I'm confused