Skip to content

Instantly share code, notes, and snippets.

@rich-97
Last active November 10, 2016 19:14
Show Gist options
  • Save rich-97/eff504d54c15bd6f371958e14af76657 to your computer and use it in GitHub Desktop.
Save rich-97/eff504d54c15bd6f371958e14af76657 to your computer and use it in GitHub Desktop.
reverse a string
#include "stdio.h"
#include "string.h"
int main () {
char str[] = "hello";
int len = strlen(str);
for (int i = len; i >= 0; i--)
printf("%c", str[i]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment