Skip to content

Instantly share code, notes, and snippets.

@leroux
Created August 18, 2012 01:59
Show Gist options
  • Save leroux/3383903 to your computer and use it in GitHub Desktop.
Save leroux/3383903 to your computer and use it in GitHub Desktop.
Reverse str back to 'password'.
#include <stdio.h>
int main (void) {
char str[] = "password";
int i = 0;
/* for pointer arithmetic */
char *ptr = str;
while (*ptr && (*ptr += (i++)))
ptr++;
printf("%s\n", str);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment