コード例 #1
0
int		ft_nmatch(char *s1, char *s2)
{
	if (*s1 == *s2 && *s1 == '\0')
		return (1);
	if (*s1 == *s2)
		return (ft_nmatch(s1 + 1, s2 + 1));
	if (*s2 == '*' && *s1 != '\0')
		return (ft_nmatch(s1 + 1, s2) + ft_nmatch(s1, s2 + 1));
	if (*s2 == '*')
		return (ft_nmatch(s1, s2 + 1));
	return (0);
}
コード例 #2
0
ファイル: ft_nmatch.c プロジェクト: GabrielPora/WeThinkCode
int		ft_nmatch(char *s1, char *s2)
{
	if (!*s1 && !*s2)
		return (1);
	else if (*s2 == '*' && !*s1)
		return (ft_nmatch(s1, (s2 + 1)));
	else if (*s2 == '*' && *s1)
		return (ft_nmatch((s1 + 1), s2) + ft_nmatch(s1, (s2 + 1)));
	else if (*s1 == *s2 && *s1)
		return (ft_nmatch((s1 + 1), (s2 + 1)));
	return (0);
}