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.
Good job, but pretty unreadable. Less lines is not always a good thing.
You're allocating only 4 bytes, so you don't have space for the null terminator.
Yeah, not reading that.
In the second for loop condition should be (arrLength-1),Because as you are using j+1 in the if condition.
so when (i=arrLength-1) this will actually compair two elements one is (arrLength-1) and another is (arrLength).
arrLength element is out the boundary of the array.because array index start from 0.
Looks like you're trying to apply for "The International Obfuscated C Code Contest" (look it up if you don't know what it is).
No offense :)
Sorry but this code is all bad. First of all, you are not checking if the input string contains character lesser than 'a', which can easily happen if the string would be corrupted. Then, you are making malloc to int* type-pointer, and whats actually worst, you are mallocing only 5 bytes, in case of longer inputs, 5 bytes are not enough to hold errors + slash + string len, so you will actually write final string without NULL termination.
good one but , you must initialize your allocated memory with memset , or just use calloc!
Yeap,I think you make sense.
But I just don't understand why I use 4 character and pass the kata.so I am a little bit confused.
(becasue I don't think it must be a string,it can be a An array of characters)
It is, and you do so by callocing instead of mallocing (which may allocate non-zeroed memory). Without it you y overrun the end of the space allocated for the string.
haha! good math!
I don't think the character for '\0' is necessary.
I wonder why the null terminator is necessary,I found most of solution just include it.
I pass this kata with a string inclue 4 characters.
Is there any problem I didn't realize?
nice,man.
Better: https://gitter.im/Codewars/codewars.com/kata-authoring-help
haha,I think so, might be my kyu is too low to creat a new fucntion.
thank u very much!
Loading more items...