Friday 4 September 2009

Structure questions with explanation in c



Structure in c example



(q) What will be output of following c code?




void main()

{

struct employee

{

unsigned id: 8;

unsigned sex:1;

unsigned age:7;

};

struct employee emp1={203,1,23};

clrscr();

printf("%d\t%d\t%d",emp1.id,emp1.sex,emp1.age);

getch();

}



Output: 203 1 23

We can access the data member in same way.

How bit data is stored in the memory:



Minimum size of

No comments:

Post a Comment