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.
there may be other mistakes, but here is the first that i saw:
you did not reserve 1 byte for the nul character (
'\0'
) inccopy
andicopy
, thus thestrcpy()
calls are undefined behavior and anything can happen during program execution. (also, variable-length arrays are bad style and should not be used in clean code)fix this, and see if your solution works
call your function with this input, and see what happens :
"abcde abcde"
also, style notes: every single cast in your code has no effect. you should use casts more sparingly, and in particular never cast the return of
malloc()
: it is not only useless but harmful, as it suppresses type checking by the compiler. it is a remnant of the ancient times in which C did not have avoid *
type, andmalloc()
returned achar *
At the risk of stating the obvious, but: if you are using some kind of
>
in your code, have you checked that you are using>=
rather than>
?Over 300 solvers in C, so it's probably a problem with your code. Have your tried printing stuff to console (inputs or intermediary steps)? That would be a good place to start.