首先是單個字符,是sizeof(char),使用的ASCII轉換為數字存儲。 控制字符有特別含義,如轉行,
這個其實就printf實現的功能,詳細需要追蹤printf函數的實現,串口打印。
1 #include "common.h" 2 #include <stdio.h> 3 #include <stdlib.h> 4 5 static float test_point = 1.3435; 6 static int normal_point = 1; 7 8 9 //8進制g 10 static int test_data = 01000; 11 static char signed_data = 0b01111111; 12 static unsigned char unsigned_data = 0b11111111; 13 static char full_signed_data = 0b11111111; 14 static char A = 'a'; 15 16 17 18 int main() 19 { 20 char letter = '\a'; 21 22 { 23 while (1) 24 { 25 printf("letter is %c\n", letter); 26 Sleep(1000); 27 }29 printf("my first task\n"); 30 } 31 32 return 0; 33 }
在window寫這個程序會有聲音,啊哈哈哈,之前使用的單片機和嵌入式linux,什么鬼,
我都不知道是什么回事。