Ad
  • Custom User Avatar

    OP solved the kata (while still returning a stack array from the function, remarkably)

  • Custom User Avatar

    this cannot be considered an issue. checking whether the address is on the heap, stack or .data segment is not supported by standard C and involves UB.

  • Custom User Avatar

    people have already been returning static buffers, so i think it would be unfair to invalidate their solutions

  • Custom User Avatar

    Memory management in C is all over the place. It's not specified how the result string should be allocated, and tests do not follow any kind of an allocation strategy for the returned string.

  • Custom User Avatar

    Your solution returns a buffer which is allocated on the stack, what is an error in C. Your answer needs to be accessible for tests, so you need to return a pointer to a buffer which lives longer than just a call to the solution function.

  • Custom User Avatar

    Hi, I have passed all the preleminary test but when I attempt it returns to me that one random did not pass. The error is :
    Expected: found the needle at position 30 Received:
    It says to me that I returned nothing but when I printed the array returned in the log and here is what I have :
    found the needle at position 30
    Which is the correct output.
    In the program I wrote I build other function. Is it possible that when we attempt it does not take these function into consideration?