From 3981746d2a9884a7106a54378bb6c74d9ac4f204 Mon Sep 17 00:00:00 2001 From: Kamila Szewczyk Date: Sun, 8 Oct 2023 15:09:04 +0200 Subject: [PATCH] strlen --- Makefile | 2 +- lib83/strlen.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 lib83/strlen.c diff --git a/Makefile b/Makefile index d8119fc..828db69 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CFLAGS=-Ilib83 -c -mz80 --std-sdcc2x --no-std-crt0 --reserve-regs-iy --opt-code- OBJS=_crt0.rel clrscr.rel putchar.rel puts.rel exit.rel gotoxy.rel __assert_fail.rel \ getchar.rel put_int.rel ctype.rel memcpy.rel memset.rel memmove.rel memcmp.rel \ - strcpy.rel \ + strcpy.rel strlen.rel \ main.rel .PHONY: all clean try diff --git a/lib83/strlen.c b/lib83/strlen.c new file mode 100644 index 0000000..e377498 --- /dev/null +++ b/lib83/strlen.c @@ -0,0 +1,9 @@ + +#include + +size_t strlen (const char * str) { + register size_t i = 0; + while(*str++) i++; + return i; +} +