top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How bit level programming is possible using structure or union?

0 votes
236 views
How bit level programming is possible using structure or union?
posted Apr 6, 2016 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

To use memory efficiently, bit field can be used. when a programmer knows what would be range of an information while storing in structure, he/she can use bit field.
For example:
struct
{
int x:3;
int y: 5
} A;

answer Apr 6, 2016 by Harshita
Similar Questions
+2 votes

I intend to write in lowest level of computer programming as a hobby, any suggestion how to start.

Tagging as C as I dont know the tag.

+1 vote

I want to add two 64-bit or more than 64-bit numbers and print sum which is of 64-bit or more than 64-bit.

+1 vote

I am using the -fdump-translation-unit option of GCC to parse C enum/structure/union/arrays. Consider the below code

enum eDAY
{
 monday = 0,
 tuesday,
 wednesday
};

enum eDAY day = monday;

I can get all the members of the enumerator parsing the dump of GCC. But if the below declaration was not present

enum eDAY day = monday;

GCC's dump doesn't have any information about the members of the enumerator. The same problem exists with structures/unions etc. How can I solve this problem. Is there some kind of optimization flag which I need to turn off so that GCC parses all the objects even if it is not used ?

...