1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2025-05-21 23:21:15 +02:00

fix: handle EXIT_FAILURE by printing error message with perror

This commit is contained in:
2023-08-07 00:11:07 +02:00
parent 72645da4b2
commit b922fd9cd3
16 changed files with 71 additions and 5 deletions

View File

@ -3,6 +3,7 @@
string_t convert_character_to_string(const char character) {
string_t string = malloc(sizeof(char) * 2);
if (string == NULL) {
perror("Error (convert_character_to_string)");
exit(EXIT_FAILURE);
}
string[0] = character;
@ -44,6 +45,7 @@ string_t convert_number_to_string(const long long integer) {
}
string_t string = malloc(sizeof(char) * length);
if (string == NULL) {
perror("Error (convert_number_to_string)");
exit(EXIT_FAILURE);
}
current = mathematics_absolute_value(integer);