aboutsummaryrefslogtreecommitdiff
path: root/c03/ex01/ft_strncmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'c03/ex01/ft_strncmp.c')
-rw-r--r--c03/ex01/ft_strncmp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/c03/ex01/ft_strncmp.c b/c03/ex01/ft_strncmp.c
new file mode 100644
index 0000000..1dc2639
--- /dev/null
+++ b/c03/ex01/ft_strncmp.c
@@ -0,0 +1,21 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strncmp.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/05 10:50:46 by cacharle #+# #+# */
+/* Updated: 2019/07/05 16:06:57 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+int ft_strncmp(char *s1, char *s2, unsigned int n)
+{
+ unsigned int i;
+
+ i = 0;
+ while (s1[i] == s2[i] && s1[i] && s2[i] && i < n - 1)
+ i++;
+ return s1[i] - s2[i];
+}