Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    In other words you point p to the value of x as an address (it's not forbidden to do it until you do use this address)
    And then using the index operation you get the new address added by the value of y and because the size of char is one you got exactly what you need...
    Great!
    But under the hood the forbidden addition is still used...
    So it's a hack...
    (cool)

  • Default User Avatar

    It uses pointer arthmatic.
    When you have pointer p.
    &p[n] is just equal to p + n*sizeof(p[0]).
    p is pointer to char, so sizeof(p[0]) is 1

  • Custom User Avatar

    Hi Etothetaui. I'm not doing translations into C right now. This kata has a version in ruby and I got ready a javascript version that will be released in some days.