Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
425 B
1
Indexable
Never
#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;
}