Ad
  • Custom User Avatar

    I guess the problem may come this line :

    long long** result = (long long**)calloc(row, sizeof(long long));

    try to declare result as :

    long long (*result)[2] = calloc(row, sizeof(lst[0]));

  • Default User Avatar

    You are using calloc, which guarantees zeroed memory, however, you are not leaving any room for the null termination. strcpy will not care that you have allocated 1 byte too little and will overwrite whatever is after that piece of memory you just allocated. This is a serious problem! Always use strncpy. However, in this case, strncpy would have refrained from null terminating your string, instead leaving you with an unterminated string for all your printfs and your zero termination check. That this passes the tests is more because the tests are bad rather than that your code functions correctly.

  • Default User Avatar

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

  • Default User Avatar

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