Ad
  • Custom User Avatar

    Here's the initial code for C:

    char *smash (const char *const words[/* count */], size_t count)
    {
    // allocate a string on the heap, memory will be freed
    	return calloc(1, 1);
    }
    

    This is what you need to implement. A function named smash that returns the result. You don't need to write main() or accept input using scanf.

    Here's a Python example how the platform works: https://docs.codewars.com/training/training-example

  • Custom User Avatar

    im sorry to everyone i did not reply to.
    i did not check my email and use codewars for a long time.

    i just got a email about ejini closing this comment.

  • Custom User Avatar

    It is not how problems with kata should be reported.

  • Default User Avatar

    i achieved the required result on dev c++ software in c language, but when i type the the exact same code here, it always finds errors and never runs. WTHeck!

  • Custom User Avatar

    I've fixed it (hopefully as what you intended to see), a lot of kata also uses this code (likely copied from some templates), so perhaps you can raise an issue everytime you've encountered them

  • Default User Avatar

    I apologize for not elaborating.

    I very much do think this is an issue - this is a beginner kata and beginners should not be presented with a sloppy mess from which they'll be trying to learn.

    JS's automatic semi-colon insertion is great, it removes the need to write something that is useless. somehow though, some people still decide to use semi-colons. which .. is fine. if they do it correctly. but this is javascript, and there are no errors, so people learn to arbitrarily sprinkle them on as if though it's needed, while also not doing it correctly. it's as if they think they have to appease the machine spirit with incense and prayers.

    I don't really care about semi-colons. but when used poorly it looks very embarassing. and that's the issue. let's not teach embarassing use of semi-colon. use them correctly, or leave them out.

    it's still there. my fault, didn't elaborate.

    that wasn't the only problem - the comment is useless, so it is also teaching useless comments to beginners, and yes, the use strict is probably not doing anything useful either, serving only to confuse, again, beginners.

  • Custom User Avatar

    Forked and approved, thanks

  • Custom User Avatar

    Done with Elixir fork above forked and approved

  • Custom User Avatar

    @trashy_incel, you're right, the previous test was derived from NASM, so I guess it should be updated too

  • Default User Avatar

    this kind of empty arrays:

    int array[] = {};
    

    is not allowed by the C standard, it's a GCC/Clang extension. it would have been better to pass NULL, which has the added benefit of making incorrect solutions crash if they attempt to access it

  • Custom User Avatar

    fixed

  • Custom User Avatar

    C:

    missing fixed and sample tests for empty arrays

  • Custom User Avatar

    Duplicate issue above

  • Custom User Avatar

    Added pass

  • Custom User Avatar

    Fixed though it is not really an issue :-)

  • Loading more items...