Binary (0b) And Hexadecimal (0x) Literals - Read The Docs

UTAT Space Systems Documentation master

Getting Started

  • Getting Started
  • Useful Websites

Software and Programming

  • Software Tools
  • Troubleshooting
  • Embedded Systems
  • Communication Protocols
  • C Programming
    • C Programming
    • Variables
    • Operators
    • Bitwise Operators
    • Control Structures
    • Functions
    • Header Files
    • #define
    • typedef
    • Pointers
    • Structs
    • .c and .h Files
    • Binary (0b) and Hexadecimal (0x) Literals
    • Integer Types
    • Print Formatting
    • Volatile Variables
  • Style Guide
  • Testing

Electronics and Altium

  • Altium
  • Electrical Systems
  • Reading Datasheets
  • Electrical Style Guide

IT

  • Remote Access
  • Remote Programming
UTAT Space Systems Documentation
  • Docs »
  • C Programming »
  • Binary (0b) and Hexadecimal (0x) Literals
  • Edit on GitHub
Binary (0b) and Hexadecimal (0x) Literals¶

Binary is a base-2 numbering system (digits are either 0 or 1), while hexadecimal is a base-16 numbering system (digits 0-F). Look online for descriptions of how these systems work.

In C, you can express integers using their binary or hexadecimal representations by prefixing them with 0b or 0x.

// These represent different numbers uint8_t binary = 0b01101011; uint8_t hex = 0xF7;

Từ khóa » C 0x 0b