- ถ้าการใช้ typedef ทำให้โปรแกรมอ่านง่ายขึ้น ก็ควรใช้
- อย่าใช้ตัวแปรที่ไม่ได้ตั้งค่า เพราะผลลัพท์จะไม่เป็นไปตามที่ต้องการ
- อย่าใช้ float หรือ double หากไม่จำเป็น แม้ว่าบางทีจะใช้แทนการได้ แต่จะทำให้ประสิทธิภาพของโปรแกรมลดลง
- พยายามอย่าใช้ค่าที่เกินขอบเขตของขนาดของชนิดข้อมูล
- อย่าใช้จำนวนลบกับชนิดข้อมูล unsigned.
ความแตกต่างระหว่าง integer กับ floating point
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) | |
{ | |
typedef unsigned int Age; | |
// typename variable_name | |
Age a = 4; | |
printf("%d",a); | |
return 0; | |
} |