#!/usr/bin/env cscript #include void cast_column_index(char *column_index_string, int column_index) { int needle_column_index_string = 0; while (column_index > 0) { column_index_string[needle_column_index_string++] = column_index % 26 + 'A'; column_index /= 26; } } int main(int argc, char *argv[]) { char column_index_string[3 + 1] = {0}; cast_column_index(column_index_string, 1); printf("1 → %s\n", column_index_string); cast_column_index(column_index_string, 25); printf("25 → %s\n", column_index_string); cast_column_index(column_index_string, 26); printf("26 → %s\n", column_index_string); cast_column_index(column_index_string, 27); printf("27 → %s\n", column_index_string); cast_column_index(column_index_string, 52); printf("52 → %s\n", column_index_string); cast_column_index(column_index_string, 53); printf("53 → %s\n", column_index_string); return 0; }