Skip to content

Instantly share code, notes, and snippets.

@gerrard00
Created April 8, 2019 15:30
Show Gist options
  • Save gerrard00/3576c5ba69c23903bc31fc1fce0dc4b0 to your computer and use it in GitHub Desktop.
Save gerrard00/3576c5ba69c23903bc31fc1fce0dc4b0 to your computer and use it in GitHub Desktop.
Toggle the case of any ascii char by xoring 32 (space character)
#include <stdio.h>
char toggle_case(char c) {
return c ^ 32;
}
int main(int argc, char ** argv) {
printf("Hello%c\n", toggle_case(*(argv[1])));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment