Last active
August 29, 2015 14:00
-
-
Save benwaffle/d2ded21a7b355d6c6845 to your computer and use it in GitHub Desktop.
xor flip case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
char flip(char in) { | |
if (isalpha(in)) | |
if (isupper(in)) | |
return tolower(in); | |
else | |
return toupper(in); | |
return in; | |
} | |
or | |
char flip(char in){ | |
return isalpha(in) ? in ^ ' ' : in; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment