user
info

reverse.c

Unlike what the name implies, this doesn't reverse a string, but instead replaces each letter with the letter that is of equal distance from the opposite end of the alphabet. E.g. A with Z, Z with A, C with X, ... I have no idea why. Last modified Mar 31, 1998.

#include <stdio.h> #include <stdlib.h> /* ugly code follows */ int i; char temp,*output; int main(int argc, char *argv[]){ if (argc>1) { output=(char *)malloc(strlen(argv[1])*sizeof(char)); for (i=0;i<strlen(argv[1]);i++){ temp=argv[1][i]; if(temp >= 'A' && temp <='Z') { temp-='A'; temp=25-temp; output[i]=temp+'A';} else if(temp>= 'a' && temp <='z'){ temp-='a'; temp=25-temp; output[i]=temp+'a';} else output[i]=argv[1][i];} printf("%s\n",output);}}