aboutsummaryrefslogtreecommitdiff
path: root/c03/ex01
diff options
context:
space:
mode:
authorCabergs Charles <cacharle@e-r6-p7.s19.be>2019-07-06 08:42:30 +0200
committerCabergs Charles <cacharle@e-r6-p7.s19.be>2019-07-06 08:42:30 +0200
commit244f5209ba7885daa513e3780b66df454422b910 (patch)
treec2123d55a7431de9bb55371dcc78c955da607c6f /c03/ex01
parent1efffca20580601c99fce13f0ade1b36ed5665a4 (diff)
downloadpiscine-244f5209ba7885daa513e3780b66df454422b910.tar.gz
piscine-244f5209ba7885daa513e3780b66df454422b910.tar.bz2
piscine-244f5209ba7885daa513e3780b66df454422b910.zip
c03 and begin c04
Diffstat (limited to 'c03/ex01')
-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];
+}