char s1[] = "Upper/LOWER."; char s2[] = "mIXeD CaSe.."; /* exchanges and flips case of s2 */ dostr (ptr1,ptr2) char *ptr1,*ptr2; { unsigned char c, tmp; while (*ptr1 != 0) { tmp = *ptr1; c = *ptr2; if (c > 0x2F) { /* make sure it is not a special char */ *ptr1 = c ^ 0x20; /* flip case of s2 */ } else { /* leave special chars alone */ *ptr1 = c; } *ptr2 = tmp; ptr1++;ptr2++; } } main() { char c; printf("Before...\n"); printf("s1: '%s'\n",s1); printf("s2: '%s'\n",s2); dostr(s1,s2); printf("After...\n"); printf("s1: '%s'\n",s1); printf("s2: '%s'\n",s2); }