Getting too fancy with my CString::length()

This commit is contained in:
Eryn Wells 2016-03-13 15:05:53 -04:00
parent d62bc7f9d4
commit 2e262df414

View file

@ -15,9 +15,9 @@ namespace CString {
size_t
length(char *str)
{
char *end = str;
while (end++ != '\0') { }
return end - str;
size_t i;
for (i = 0; str[i] != '\0'; i++) { }
return i;
}