diff options
-rw-r--r-- | ch2/2-03.c | 2 | ||||
-rw-r--r-- | ch2/2-04.c | 8 | ||||
-rw-r--r-- | ch2/2-05.c | 4 | ||||
-rw-r--r-- | ch2/2-10.c | 2 |
4 files changed, 8 insertions, 8 deletions
@@ -8,7 +8,7 @@ unsigned int htoi(char hex[]) { int power; unsigned int result; - for (length = 0; hex[length] != '\0'; ++length) + for (length = 0; hex[length]; ++length) power = 1; result = 0; @@ -5,7 +5,7 @@ void squeeze_char(char s[], char c) { int i; int j; - for (i = j = 0; s[i] != '\0'; i++) + for (i = j = 0; s[i]; i++) if (s[i] != c) s[j++] = s[i]; @@ -16,7 +16,7 @@ void squeeze_char(char s[], char c) { void squeeze_str(char s1[], char s2[]) { int i; - for (i = 0; s2[i] != '\0'; ++i) + for (i = 0; s2[i]; ++i) squeeze_char(s1, s2[i]); } @@ -26,8 +26,8 @@ void squeeze_all(char s1[], char s2[]) { int j; int k; - for (k = 0; s2[k] != '\0'; ++k) { - for (i = j = 0; s1[i] != '\0'; ++i) + for (k = 0; s2[k]; ++k) { + for (i = j = 0; s1[i]; ++i) if (s1[i] != s2[k]) s1[j++] = s1[i]; @@ -4,8 +4,8 @@ int any(char s1[], char s2[]) { int i; int j; - for (i = 0; s2[i] != '\0'; ++i) - for (j = 0; s1[j] != '\0'; ++j) + for (i = 0; s2[i]; ++i) + for (j = 0; s1[j]; ++j) if (s2[i] == s1[j]) return j; @@ -16,7 +16,7 @@ int main() { void lower_str(char source[], char dest[]) { int i; - for (i = 0; source[i] != '\0'; i++) + for (i = 0; source[i]; i++) dest[i] = lower_char(source[i]); dest[i] = '\0'; |