• + 2 comments

    I saw this was different than the other problems. I put it in the bottom of main, using n, d and a.

    Are you using C? There appears to be a bug in the original code in their loop that builds a. This is my fix to their problem:

    // bug in original code - only check endptr if we need to do another loop
    //      if (a_item_endptr == a_item_str || *a_item_endptr != '\0') { exit(EXIT_FAILURE); }
    if (a_item_endptr == a_item_str) { exit(EXIT_FAILURE); }
    
    if (i < (n-1))
    {
        if (*a_item_endptr != '\0') { exit(EXIT_FAILURE); }
    }
    *(a + i) = a_item;