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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -