Your question is hopelessly vague. There are all sorts of mappings from
integers to character strings. Here are just a few (with quote marks
omitted):
Arabic numerals:
Tally:
Roman numerals:
Cardinal:
English: forty-two
German: zwei und vierzig (Note: AltaVista Babelfish gets this wrong!)
So do you said:
Ordinal:
Traditional base 12:
English: three dozen and six
Three and a half dozen would be more likely.
Traditional by Abraham Lincoln:
Base64 (as used in HTLM/XML/etc.):
Aq==
Oh, you just want a single character? That's not possible because the
range of integers is larger than the range allowed for a single
character, whether a single byte (US-ASCII or Latin-1) or double byte
(subset of UniCode). If you restrict the range of integers to what
will fit in a single byte, then you have your choice of Latin-1 or
several other system-dependent codes. If you restrict the range of
integers to what will fit in 7 bits, you have your choice of US-ASCII
or EBCDIC. (C provides support only for US-ASCII, via a "cast".)
No, C provides support for whatever the implementation and runtime
character sets are, which need not be US-ASCII. EBCDIC works just as
well, as does any character set which fulfils the requirements:
Section 5.2.1 "Character sets"
3 Both the basic source and basic execution character sets shall have
the following members: the 26 uppercase letters of the Latin
alphabet
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
the 26 lowercase letters of the Latin alphabet
a b c d e f g h i j k l m
n o p q r s t u v w x y z
the 10 decimal digits
0 1 2 3 4 5 6 7 8 9
the following 29 graphic characters
! " # % & ' ( ) * + , - . / :
; < = > ? [ \ ] ^ _ { | } ~
the space character, and control characters representing horizontal
tab, vertical tab, and form feed. The representation of each member
of the source and execution basic character sets shall fit in a
byte. In both the source and execution basic character sets, the
value of each character after 0 in the above list of decimal digits
shall be one greater than the value of the previous. In source
files, there shall be some way of indicating the end of each line of
text; this International Standard treats such an end-of-line
indicator as if it were a single new-line character. In the basic
execution character set, there shall be control characters
representing alert, backspace, carriage return, and new line.
If you restrict the range of integers to 0 thru 35, you have extended
IBM-hexadecimal: 0123...9ABCDE...XYZ. If you restrict the range to
only 0 thru 15, C provides support via sprintf(&ch, "%x", intval).
If you restrict it to 0..63 you can use the Base64 encoding:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789+/
Chris C