Ad
  • Default User Avatar

    I really like the idea of this solution; scanning the data pointer around the edge then moving to the inner edge! Seems like everyone else, myself included, did calculations to find the next element to copy instead of just moving it around. This is much easier to read, I would imagine.

  • Default User Avatar

    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.