- ASCII Code คือมารตฐานของระบบคอมพิวเตอร์ที่จัดเก็บตัวอักษรไว้ใน 1 Byte. แต่ส่วนมากก็จะมีมากกว่า ASCII Code เช่นคอมพิวเตอร์ของคุณที่สามารถอ่านภาษาไทยนี้ได้
- ตัวอักษรจะเก็บไว้ในรูปของ interger
- ตัวอักษรสามารถแสดงเป็นตัวเลขได้ เช่น การใช้ %d ใน printf
- ตัวเลขก็สามารถแสดงเป็นตัวอักษรได้ เช่นการใช้ %c ใน printf . เช่น printf(“%c” , 67);
- การจำตาราง ASCII ทำได้ง่ายคือ จำแค่ A = 65 จากนั้นก็บวกทีละ 1 ก็จะได้ค่า B , C ,D ตามลำดับ เช่นเดียวกันกับ a = 97 , ตัวอักษรแสดงเลขศูนย์ มีค่า ASCII คือ 48 .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
setbuf(stdout,NULL); | |
//char | |
char x = 'k'; | |
printf("%c\n",x); | |
printf("%d\n",x); | |
char name[100]={'a','b','c','\0'}; | |
//char surname[20]; | |
printf("ENter your name : "); | |
scanf("%s",name ); | |
printf("%s",name); | |
return 0; | |
} |