Skip to content

Instantly share code, notes, and snippets.

@rhardih
Created June 1, 2014 21:28
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 rhardih/cd9a39e875c8bd50c9db to your computer and use it in GitHub Desktop.
Save rhardih/cd9a39e875c8bd50c9db to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[])
{
int i, j, mod;
char tmp[50] = "";
char result[50] = "";
for(i = 1; i < 817; i++) {
j = i;
result[0] = '\0';
while(j > 0) {
mod = (j - 1) % 26;
sprintf(tmp, "%c", mod + 65);
j = (j - mod) / 26;
strcat(tmp, result);
sprintf(result, "%s", tmp);
}
printf("%s\n", result);
}
return 0;
}
@rhardih
Copy link
Author

rhardih commented Jun 1, 2014

gcc colnames.c && ./a.out | column -c 257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment