From dfee2809df25e697b77087fbbd0f391e8ad5abf6 Mon Sep 17 00:00:00 2001 From: "Felix C. Stegerman" Date: Fri, 19 Jun 2020 15:26:33 +0200 Subject: [PATCH] startsWith: add comment about checkling strlen(a) --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index 14f030d..b4f28f1 100644 --- a/main.cpp +++ b/main.cpp @@ -143,6 +143,7 @@ bool strEqual(char const* a, char const* b) { } bool startsWith(char const* a, char const* b) { + // not checking the length of a is safe b/c a[strlen(a)] != b[strlen(a)] if strlen(a) < strlen(b) int const length = strlen(b); for (int i = 0; i < length; ++i) { if (a[i] != b[i]) {