Update cv7/program.c

This commit is contained in:
Viktor Daniv 2024-11-15 01:13:12 +00:00
parent 8256e13864
commit e895d49e1a

View File

@ -83,14 +83,14 @@ struct tree* read_tree() {
char* r = fgets(buffer, SIZE, stdin); char* r = fgets(buffer, SIZE, stdin);
if (r == NULL) { if (r == NULL) {
// fprintf(stderr, "Chybna databaza\n"); // fprintf(stderr, "Chybna databaza\n");
exit(1); // Exit the program if reading fails node = NULL; // Exit the program if reading fails
} }
// Allocate memory for a new tree node // Allocate memory for a new tree node
struct tree* node = calloc(1, sizeof(struct tree)); struct tree* node = calloc(1, sizeof(struct tree));
if (!node) { if (!node) {
printf("Memory allocation failed!\n"); //printf("Memory allocation failed!\n");
exit(1); node = NULL;
} }
// Copy the input line into the node's value // Copy the input line into the node's value