Sometimes you just want to quickly see the ASCII code for a letter or vice versa. I actually remember using this regularly, because my most common use case was wanting the ASCII code for a character, and the way this was written, the first argument was always interpreted as a number and would then show you the character for that code. The second argument is the one that matched my more common use case. So most of the time I used this, I'd give it a garbage first argument. I don't know why I never modified it to better match my common use case. Last modified Jun 28, 1999.

#include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc,char *argv[]){ int asc=0,i; if (argc>1){ printf("%s is %c in ascii\n",argv[1],strtol(argv[1],NULL,16)); } if (argc>2){ for(i=0;i<strlen(argv[2]);i++){ printf("\nthe ascii value of %c is %x",argv[2][i],argv[2][i]);} printf("\n"); } return 0; }