ft_cptcmp.c 1.1 KB

12345678910111213141516171819202122232425
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_cptcmp.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2017/01/31 14:14:51 by bchanot #+# #+# */
  9. /* Updated: 2018/10/29 12:15:59 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. size_t ft_cptcmp(const char *const s1, const char *const s2)
  14. {
  15. size_t i;
  16. i = 0;
  17. if (!s1 || !s2)
  18. return (0);
  19. while (s1[i] && s2[i] && s2[i] == s1[i])
  20. i++;
  21. return (i);
  22. }