Getting too fancy with my CString::length()
This commit is contained in:
parent
d62bc7f9d4
commit
2e262df414
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue