Untitled
unknown
plain_text
2 years ago
425 B
10
Indexable
#include <stdio.h>
int ft_strncmp(char *s1, char *s2, unsigned int n)
{
unsigned int i;
i = 0;
while ( i < n)
{
if (s1[i] != s2[i])
{
return s1[i] - s2[i];
}
i++;
}
return 0;
}
int main() {
char i[] = "PamMoe";
char j[] = "Pamsocute";
int result = ft_strncmp(i, j, 5);
printf(" %d", result);
return 0;
}Editor is loading...