[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Interview Questions and Answers :: Broadcom Ltd

11. Declare 1 bit variable and print it.

Answer:

typedef struct size_t
{
    unsigned x:1;
} size_1;
Where you have told the compiler that you'll only be using one bit of x.

But due to structure packing arrangements (the C standard is intentionally flexible in order that compilers can optimize according to the machine architecture), it may well turn out that this still occupies as much space in memory as a regular unsigned and an array of  size_1 doesn't have to be bitwise contiguous.

Generally, the smallest addressable chunk of data in C is a byte. You can not have a pointer to a bit, so you can not declare a variable of 1 bit size, But above can be one way to have 1 bit size.

Post Your Answer Here:      Public      Private

Rate This: +0 -0
Report     

Post Your Reply Here:     

Report Error

Report Error

Please Login First Click Here