Ad
  • Custom User Avatar

    Out of curiosity based on how i refactored my solution, why is this more popular of a solution than return (cast) (a+b)? It seems declaring another variable, even a local one, is more work than needs to be done when you can just return the value.

    Is there a best practice that says a declared local variable is less prone to bugs or is it just preference as ease of understanding?

  • Custom User Avatar

    a and b already are of the type byte, so casting them will not do anything. However, the addition operator + returns an int (as bytes are not necessarily used as numbers, so a + b implicitly does is (int) a + (int) b), hence we do need to cast the result.

  • Default User Avatar

    The translator did a bogus version for C++ and C, and never corrected them. Unfortunately, nobody with the competences in these languages came by to fix them.

    EDIT: no need to raise them same issue several times.

  • Default User Avatar

    Yes, that's it. You have to do the same thing faster, now.

  • Default User Avatar

    basic tests 1 and 2 succeed but all random cases fail.
    As "ooflorent" already mentioned, my solution for [+..,,] also outputs:

    if (*p) do {
      *p += 1;
      putchar(*p);
      putchar(*p);
      *p = getchar();
      *p = getchar();
    } while (*p);