• + 4 comments

    As a C programmer, be sure to release all memory allocated in the program, if you are using the stub code provided by HR, add following at the end of main, it looks HR does not encourage memory management at all, this is a bad practice.

    for (int i = 0; i < towns_count; i++) {
            for (int j = 0; j < towns[i].offices_count; j++) {
                for (int k = 0; k < towns[i].offices[j].packages_count; k++) {
                    free(towns[i].offices[j].packages[k].id);
                }
                free(towns[i].offices[j].packages);
            }
            free(towns[i].offices);
            free(towns[i].name);
        }
        free(towns);