We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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;
Left Rotation
You are viewing a single comment's thread. Return to all 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: