How to convert C language characters to ASCII codes
Most people don't understand the knowledge points of this article "How to convert C language characters to ASCII code", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "How to convert C language characters to ASCII code".
ASCII defines 128 characters.
Category:
1:0-31, 127 (delete key) are control characters
Two: white space characters: spaces (32), tabs, vertical tabs, newlines, carriage returns.
Three: can display characters: a-z, A-Z, 0-9,~,!,@, %,^,&,#,$, *,(、)、-、+、{、}、[、]、'、"、、,、?、/、|、\、_、:、;、.,There is also a pause.
ASCII table:
ASCII Value Control Character 0NUT32(space)64@96, 1SOH33! 65A97a2STX34"66B98b3ETX35#67C99c4EOT36$68D100d5ENQ37%69E101e6ACK38&70F102f7BEL39'71G103g8BS40(72H104h9HT41)73I105i10LF42*74J106j11VT43+75K107k12FF44,76L108l13CR45-77M109m14SO46.78N110n15SI47/79O111o16DLE48080P112p17DCI49181Q113q18DC250282R114r19DC351383S115s20DC452484T116t21NAK53585U117u22SYN54686V118v23TB55787W119w24CAN56888X120x25EM57989Y121y26SUB58:90Z122z27ESC59;91[123{28FS6094^126~31US63? 95_127DEL Instance
#include
int main(){
char c;
printf("Enter a character: ");
//read user input
scanf("%c", &c);
// %d Display integer
// %c Display corresponding characters
printf("ASCII for %c is %d", c, c);
return 0;
}
Run Results:
Enter a character: aa ASCII for 97 or more is about "C language characters how to convert ASCII code" this article content, I believe everyone has a certain understanding, I hope the content shared by Xiaobian is helpful to everyone, if you want to know more related knowledge content, please pay attention to the industry information channel.