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.
I recommend that you put your kata into
Draft
mode whilst adding random tests.I'll take a look soon, on mobile right now and it's too cumbersome...
tester()
could be significantly streamlined:stringer()
function to stringify the input, expected and actual arraysHere is the official documentation on Random Tests.
Done
everywhere you write
bool (*predicate)(int)
, you can writePredicate predicate
insteadThis comment is hidden because it contains spoiler information about the solution
int
typedef
Empty parameter lists (
()
) before C23 mean "takes an unspecified number of parameters of unspecified types" (in C23 it means the same as(void)
). Their behavior should not be relied upon, as it is a legacy feature that forgoes type safety (For examplereject()
will hapily accept a call with a function such asand crash when it passes an integer to
foo()
).You have to add
int
to the parameter list. Also, function pointers are usually handled through atypedef
:approved
fixes merge conflict
done, thanks
On the other hand, if in fact you're asking why the kata has the particular rules that it has, that would be a question for its author. Beyond that, we remain tasked with following those rules to come up with a solution, regardless of to what degree it could be assessed as a reasonable real-world situation.
Because of the logic of the kata.
So use that to solve the kata.
Loading more items...