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.
Because they are initializing with these definitions:
long first = numbers[0], second = numbers[1];
size_t i = 2 means the first numbers[i] is really numbers[2].
'looks like u solved it'
make sure you put
i < length
instead ofi <= length
thank you so much, i see now,
thanks to your help now I can try finish the second part of the kata
thank you orz
Yes,
'\0'
is a null terminator, but it's not the on which causes your trouble. This line:new[k] = text[sub];
(probably unintentionally) adds a null terminator in the very beginning of your string (atnew[0]
), effectively causing it to always have length of 0.Again, do not guess and change your program randomly. It will be easier to step through your solution in debugger, locally, in your IDE, and see what exactly happens.
is this '\0' null terminator?
i tried to remove it and I was still getting zero length
i also tried new[len+1]= '\0'
Did you try to debug your solution locally in your IDE? Stepping through your solution you should see how you add null terminator at the very beginning of the string.
This comment is hidden because it contains spoiler information about the solution
why do we need
size_t i = 2
here?does size_t make
i
an array?Well, that's JavaScript of course.
@mil3zh: You need to split the string so that it will be an array.
Can't see what programming language you are using, so don't know. This comment section is not really a good place to ask for help.
Because reduce is an array method, and numbers is a string.
This comment is hidden because it contains spoiler information about the solution
what is the slice(2,integer) here for?
Answered.
Loading more items...