| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_sort_int_array | ||
| 4 | ** File description: | ||
| 5 | ** Sorts an array (array) with a defined size (size) | ||
| 6 | ** of integers in ascending order | ||
| 7 | */ | ||
| 8 | /** | ||
| 9 | * @file my_sort_int_array.c | ||
| 10 | * @brief The file containing the my_sort_int_array function | ||
| 11 | * @author Nicolas TORO | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "my.h" | ||
| 15 | |||
| 16 | 10 | static void sort_tab(int *array, int temp, int i, int j) | |
| 17 | { | ||
| 18 | 2/2✓ Branch 0 taken 3 times. ✓ Branch 1 taken 7 times. | 10 | if (array[j] < array[i]) { | 
| 19 | 3 | temp = array[i]; | |
| 20 | 3 | array[i] = array[j]; | |
| 21 | 3 | array[j] = temp; | |
| 22 | } | ||
| 23 | 10 | } | |
| 24 | |||
| 25 | 1 | void my_sort_int_array(int *array, int size) | |
| 26 | { | ||
| 27 | 1 | int temp = 0; | |
| 28 | |||
| 29 | 2/2✓ Branch 0 taken 6 times. ✓ Branch 1 taken 1 times. | 7 | for (int i = 0; i <= size; i++) { | 
| 30 | 2/2✓ Branch 0 taken 10 times. ✓ Branch 1 taken 6 times. | 16 | for (int j = i + 1; j < size; j++) { | 
| 31 | 10 | sort_tab(array, temp, i, j); | |
| 32 | } | ||
| 33 | } | ||
| 34 | 1 | } | |
| 35 |