Skip to content

Commit fd0fb46

Browse files
author
Shell-thon
committed
update
1 parent 5580508 commit fd0fb46

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

0x08-recursion/101-wildcmp.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include"main.h"
1+
#include "main.h"
22

33
/**
44
* wildcmp - Compares two strings considering the '*' wildcard.
@@ -9,21 +9,21 @@
99
*/
1010
int wildcmp(char *s1, char *s2)
1111
{
12-
if (*s2 == '*')
13-
{
14-
if (*(s2 + 1) == '*')
15-
return wildcmp(s1, s2 + 1);
16-
else if (*(s2 + 1) == '\0')
17-
return 1;
18-
else if (*s1 == '\0')
19-
return wildcmp(s1, s2 + 1);
20-
else
21-
return wildcmp(s1, s2 + 1) || wildcmp(s1 + 1, s2);
22-
}
23-
else if (*s1 != *s2)
24-
return 0;
25-
else if (*s1 == '\0')
26-
return 1;
27-
else
28-
return wildcmp(s1 + 1, s2 + 1);
12+
if (*s2 == '*')
13+
{
14+
if (*(s2 + 1) == '*')
15+
return (wildcmp(s1, s2 + 1));
16+
else if (*(s2 + 1) == '\0')
17+
return (1);
18+
else if (*s1 == '\0')
19+
return (wildcmp(s1, s2 + 1));
20+
else
21+
return (wildcmp(s1, s2 + 1) || wildcmp(s1 + 1, s2));
22+
}
23+
else if (*s1 != *s2)
24+
return (0);
25+
else if (*s1 == '\0')
26+
return (1);
27+
else
28+
return (wildcmp(s1 + 1, s2 + 1));
2929
}

0 commit comments

Comments
 (0)