Modifier ใช้เพื่อเปลี่ยนความหมายของ base type ให้ทำงานตามความต้องการของคุณ ตัวอย่างเช่น เวลาไม่สามารถเป็นค่าลบได้ จึงสมเหตุสมผลที่จะทำให้เป็น unsigned C++ อนุญาตให้ char, int, และ double มี modifiers นำหน้าได้ ตัวปรับแต่งชนิดข้อมูลมีดังนี้:
- signed
- unsigned
- long
- short
Modifiers signed, unsigned, long, และ short สามารถนำไปใช้กับ integer base types เพิ่มเติม signed และ unsigned ใช้กับ char ได้ และ long ใช้กับ double ได้
Modifiers signed และ unsigned ยังสามารถใช้เป็น prefix ก่อน long หรือ short modifiers ได้ เช่น unsigned long int
C++ อนุญาต shorthand notation สำหรับประกาศ unsigned, short, หรือ long integers คุณสามารถใช้คำว่า unsigned, short, หรือ long โดยไม่ต้องใส่ int int ถูก implied ตัวอย่าง:
unsigned long a; // AND unsigned long int a; // Are the same