Refactor c/isogram/length to exclude null char
Since we're no longer copying, we don't need to include that char in our length. It just adds an extra iteration step.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
int length(const char string[]) {
|
||||
int i = 0;
|
||||
while (string[i] != '\0') { i++; }
|
||||
return i+1; // Account for terminating null char.
|
||||
return i;
|
||||
}
|
||||
|
||||
char lowercase(char c) {
|
||||
|
||||
Reference in New Issue
Block a user