一、容易遺忘之轉義字元

轉義序列 含義
\n 換行
\t 水平製表
\\ 輸出反斜槓
\a 響鈴符
\'' 輸出雙引號
\' 輸出單引號
\? 輸出問號
\r 輸出回車符(不換行,游標定位當前行的開始位置)
\b 退格
   

二、輸出佔位符

#include<stdio.h>
int main(void)
{
printf("%d %d %d",2,33,556)//輸出實際寬度
printf("%5d %5d %5d",2,33333,556)//規定寬度為5,不足5位的右對齊
printf("%-5d %-5d %-5d",2,33333,556)//規定寬度為5,不足5位的左對齊
return 0;
}

執行結果:

//2 33 556
// 2 33333 556
//2 33333 556

三、資料型別的變數所佔儲存空間大小:

/*sizeoftype.c*/
#include<stdio.h>
int main(void)
{
printf(''Data type number of Bytes\n'');
printf(''----- -------------------\n'');
printf("char %d\n",sizeof(char));
printf("int %d\n",sizeof(int));
printf("float %d\n",sizeof(float));
printf("double %d\n",sizeof(double));
return 0;
}

執行結果:

//Data       type number of Bytes
//----- -------------------
//char 1
//int 4
//float 4
//double 8