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.
Please use markdown to post your code next time ;-)
n == 0
: you need to return amalloc()
'ed string in each case. This is why the tests crash: they try tofree()
your returned string, but a string literal cannot be freed.Other mistakes:
i
starts at1
, but you printi + 1
to the string, so1 sheep...
is missingn == 10000
,"10000 sheeep..."
will be15
characters long, but you allocate only13
formur
and13 * n
formurmur
---> for largen
you will run out of memory and write out-of-boundslook at the length and the individual bytes of your string - it does not work perfectly, you are not measuring correctly. granted, I can see how that would be confusing, but, it also seems like the sort of thing to watch out for in C with all the footguns available