Skip to content

Instantly share code, notes, and snippets.

@mouseroot
Created March 10, 2017 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mouseroot/5aa6d07d8d397aaf0c51e0f023cb53da to your computer and use it in GitHub Desktop.
Save mouseroot/5aa6d07d8d397aaf0c51e0f023cb53da to your computer and use it in GitHub Desktop.
Rotate a String in C
char *rotateString(char *str, int count) {
size_t len = strlen(str);
int counter;
for(counter=0;counter < len;counter++) {
int value = str[counter];
if((char)value != ' ') {
value = value + count;
str[counter] = value;
}
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment