Can I define the size of a C element in bits? -
in following example, can define size of c element in bits?
#include <stdio.h> typedef enum { false = 0, true = ~0 } bool; int main(void) { bool x; printf("%d", sizeof x); return 0; }
in general, no. minimum addressable unit byte, not bit.
you can funny things bitfields, such as:
struct { unsigned : 31; unsigned b : 1; };
that struct likely have sizeof == 4
, a
use 31 bits of space, , b
use 1 bit of space.
Comments
Post a Comment