On this page
CHAR_BIT
Prev: INT_MAX | Up: limits.h | Next: DBL_EPSILON
Rel: limits.h, stdint, stdbool & limits Guide
Ref: cppreference — CHAR_BIT
Tags: #public #prog #c #stdlib #limits #tier/standard
Include
#include <limits.h>
Signature & Overview
#define CHAR_BIT /* >= 8 */
Number of bits in a byte (char), 8 on POSIX/Windows/macOS.
Notes & Pitfalls
- Bits per
char(almost universally8): Usesizeof(x) * CHAR_BITwhen computing bit widths portably.
Example
#include <assert.h>
#include <limits.h>
int main(void) { assert(CHAR_BIT >= 8); }
Linked from
Related notes
- tuts/c/stdlib/limits/DBL_EPSILON Linked here; links to this page; shared tags: #c, #limits, #prog, #stdlib, #tier
- tuts/c/stdlib/limits/INT_MAX Linked here; links to this page; shared tags: #c, #limits, #prog, #stdlib, #tier
- tuts/c/stdlib/limits Linked here; links to this page; shared tags: #c, #limits, #prog, #stdlib
- tuts/c/stdlib/stdint_stdbool_and_limits Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/stdlib/assert/assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/static_assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isalpha shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isdigit shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isspace shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/tolower shared tags: #c, #prog, #stdlib, #tier