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.
Just FYI, you can post your code here in this thread, if you mark your post as spoiler and use markdown code formatting.
Now about your code: there's a lot going there, and there is a couple of problems with it. But the most important problem is that your solution suffers from buffer overflows. Did you try to run your solution in your local IDE, with all test cases given in sample tests? I changed your solution in two places by adding one character and it passed for me.
Other problems:
convertToText
is bad,comparator
is bad,sizeof(char)
is always superfluous and unnecessary,Sorry, but we can't see why either :(
Maybe if we could see your code we could know why it crashes.
g964 is right, you are not reporting the length of your array:
does not work like you think it does. It merely changes the address held by
lg
locally to your function, it is not visible from the outside. It is*lg
(the value thatlg
points to) that you need to assign to.Currently, it's just like you had done this:
You returned array has a length of 0 (hence {}). Do you fill correctly lg?
Question answered.
There may be other things, but you have an out-of-bounds access here:
(also,
char unpacked[1000];
when you have no guarantee that the length will be < 1000 is very bad)