Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ft_strncmp(char *s1, char *s2, unsigned int n)
- {
- unsigned int i;
- i = 0;
- while (s1[i] != '\0' && s2[i] != '\0' && i < n)
- {
- if (s1[i] != s2[i])
- return (s1[i] - s2[i]);
- i++;
- }
- if (i < n && ((s1[i] == '\0' && s2[i] != '\0') ||
- (s2[i] == '\0' && s1[i] != '\0')))
- return (s1[i] - s2[i]);
- return (0);
- }
Add Comment
Please, Sign In to add comment