calibration : ajout de newlines pour la lisibilité

This commit is contained in:
Ahurac 2024-02-20 15:20:17 +01:00
parent eb0b69bef4
commit 31dcab5853

View file

@ -47,16 +47,20 @@ unsigned int get_calibration_sum(FILE *input_file) {
unsigned int sum = 0;
char *current_line, *reversed_line;
char intermediate_buffer[3];
intermediate_buffer[2] = '\0';
while (!feof(input_file)) {
current_line = read_line(input_file);
reversed_line = strrev(current_line);
if (*current_line != '\0') {
intermediate_buffer[0] = first_digit(current_line);
intermediate_buffer[1] = first_digit(reversed_line);
sum += atoi(intermediate_buffer);
}
free(reversed_line);
free(current_line);
}