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.
apart from several smaller bugs (
sum
is not initialized with zeroes,string
is missing 1 byte for the nul-terminator), there is a more fundamental flaw in your approach: you split the strink into separate chunks withstrtok()
, and return one of those substrings. this means the returned pointer cannot be passed tofree()
, because it is no longer the original pointer that was allocated. this is why the code crashes.is undefined behavior, you must pass the original pointer
You are given an array (which will have a length of at least 3, but could be very large)
{ 0,2,3 } test not pass
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You can find some suggestions here.
This comment is hidden because it contains spoiler information about the solution