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.
- Prepare
- C
- Structs and Enums
- Post Transition
- Discussions
Post Transition
Post Transition
Sort by
recency
|
124 Discussions
|
Please Login in order to post a comment
just include
Correct Solution ;
include
include
include
define MAX_STRING_LENGTH 6
struct package { char* id; int weight; };
typedef struct package package;
struct post_office { int min_weight; int max_weight; package* packages; int packages_count; };
typedef struct post_office post_office;
struct town { char* name; post_office* offices; int offices_count; };
typedef struct town town;
void print_all_packages(town t) { printf("%s:\n", t.name); for (int i = 0; i < t.offices_count; i++) { printf("\t%d:\n", i); for (int j = 0; j < (t.offices[i]).packages_count; j++) { printf("\t\t%s\n", ((t.offices[i]).packages[j]).id); } } }
void send_all_acceptable_packages(town* source, int source_office_index, town* target, int target_office_index) { post_office *src = &(source->offices[source_office_index]); post_office *dst = &(target->offices[target_office_index]); package buff[src->packages_count]; int buff_size = 0;
}
int total_packages(town t) { int sum = 0; for (int i = 0; i < t.offices_count; i++) { sum += t.offices[i].packages_count; } return sum; }
town town_with_most_packages(town* towns, int towns_count) { int max_packages = 0; int town_index = 0;
}
town* find_town(town* towns, int towns_count, char* name) { for (int i = 0; i < towns_count; i++) { if (strcmp(towns[i].name, name) == 0) { return &towns[i]; } } return NULL; }
int main() { int towns_count; scanf("%d", &towns_count);
}
The Samsung Galaxy S21 FE 5G is a powerful and affordable smartphone with a large display, versatile camera system, and long battery life. Mahajan Electronics is the best store located in Delhi, India, where you can buy Samsung Galaxy S21 FE 5G with a special discount. Buy Now!
include
include
include
include
define PACKAGE_NAME_MAX_LENGTH 6
define TOWN_NAME_MAX_LENGTH 6
typedef struct { char* id; int weight; } Package;
typedef struct { int min_weight; int max_weight; Package* packages; int packages_count; } PostOffice;
typedef struct { char* name; PostOffice* offices; int offices_count; } Town;
Package create_package() {
}
PostOffice create_post_office() {
}
Town create_town() {
}
void send_all_acceptable_packages(const Town* source, const int source_office_index, Town* target, const int target_office_index); void add_package_to_office(PostOffice* office, const Package package); Town* town_with_most_packages(const Town* towns, const int towns_count); Town* find_town(const Town* towns, const int towns_count, const char* town_name); bool is_package_acceptable(const PostOffice* target_office, const Package* package); void print_all_packages(const Town* town);
// ----------------- .h file above -----------------
void send_all_acceptable_packages(const Town* source, const int source_office_index, Town* target, const int target_office_index) {
PostOffice* target_office = &target->offices[target_office_index]; Package current_package;
}
void add_package_to_office(PostOffice* office, const Package package) {
}
Town* town_with_most_packages(const Town* towns, const int towns_count) {
}
Town* find_town(const Town* towns, const int towns_count, const char* town_name) {
}
bool is_package_acceptable(const PostOffice* target_office, const Package* package) {
}
void print_all_packages(const Town* town) {
}
int main() { int towns_count; int offices_count; int packages_count;
}
Hello! I'm having this little problem in the output: 'Runtime error', compiler message 'segmentation fault'.
Does anyone know how to fix this? Here's the code: