string: strnlen

This commit is contained in:
Matheus
2026-04-06 21:40:40 -03:00
parent 9a1b23a320
commit 2ebd08e949
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -65,6 +65,15 @@ size_t strlen(const char *a) {
return s;
}
size_t strnlen(const char *a, size_t max) {
size_t s = 0;
while (s < max && a[s] != '\0')
++s;
return s;
}
int strncmp(const char *a, const char *b, size_t c) {
int diff = 0;