#include #include #include char *to_upper_subtraction(char *s) { for (int i = 0; s[i]; i++) { if (s[i] >= 'a' && s[i] <= 'z') { s[i] -= 32; } } return s; } char *to_upper_bitwise(char * s) { for (int i = 0; s[i]; i++) { if (s[i] >= 'a' && s[i] <= 'z') { s[i] &= 0b11011111; } } return s; } bool case_insensitive_compare_bitwise(char *s1, char *s2) { for (int i = 0; s1[i] && s2[i]; i++) { if ((s1[i] | 0b00100000) != (s2[i] | 0b00100000)) { return false; } } return true; } int main(void) { char s1[] = "Hello, World!"; char s2[] = "Hello, World!"; assert(0 == strcmp("HELLO, WORLD!", to_upper_subtraction(s1))); assert(0 == strcmp("HELLO, WORLD!", to_upper_bitwise(s2))); char s3[] = "HeLLo, WOrLD!"; char s4[] = "hEllo, WORld!"; assert(case_insensitive_compare_bitwise(s3, s4)); }