GCC Code Coverage Report


Directory: ./
File: lib/my/my_revstr.c
Date: 2024-06-05 00:29:21
Exec Total Coverage
Lines: 9 9 100.0%
Functions: 1 1 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_revstr
4 ** File description:
5 ** Reverses the characters in a string (str) and returns the string (str)
6 */
7
8 791 char *my_revstr(char *str)
9 {
10 791 int len = 0;
11 char temp;
12
13
2/2
✓ Branch 0 taken 2463 times.
✓ Branch 1 taken 791 times.
3254 while (str[len] != '\0') {
14 2463 len = len + 1;
15 }
16
2/2
✓ Branch 0 taken 968 times.
✓ Branch 1 taken 791 times.
1759 for (int i = len / 2; i > 0; i--) {
17 968 temp = str[i - 1];
18 968 str[i - 1] = str[len - i];
19 968 str[len - i] = temp;
20 }
21 791 return str;
22 }
23