目次

数値から数字に変換

 0〜9、10〜15を'0'〜'9'、'A'〜'F'に変換。


配列定義

typdef unsigned char UBYTE ; UBYTE asc_hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};

使い方

putchar( asc_hex[0] ) ;

関数での実現

 関数を利用して文字定数を計算します。 char getAsc(unsigned char x) { char result ; /* default */ result = '0' ; /* judge */ if ( x < 10 ) { result = x + '0' ; } else { result = x - 10 + 'A' ; } return result ; }

目次

inserted by FC2 system