seshreddy
April 23rd, 2003, 07:50 AM
#include <iostream.h>
hi,
I want to use structure for reprentation of bits and do not want
maximum size of integer.
here I have given the code and it is giving out put for size of structure as 4 bytes.
but how can i get exact size what i am using.
struct packet
{
int FC :8;
int DS :4;
};
int main()
{
packet pack;
cout<<"size ofpacket"<<sizeof(pack)<<endl;
pack.FC=124;
pack.DS=15;
cout<<"pack.FC="<<pack.FC<<endl;
cout<<"pack.DS="<<pack.DS<<endl;
cout<<sizeof(packet);
return 0;
}
please hel p me..
bye
seshu
hi,
I want to use structure for reprentation of bits and do not want
maximum size of integer.
here I have given the code and it is giving out put for size of structure as 4 bytes.
but how can i get exact size what i am using.
struct packet
{
int FC :8;
int DS :4;
};
int main()
{
packet pack;
cout<<"size ofpacket"<<sizeof(pack)<<endl;
pack.FC=124;
pack.DS=15;
cout<<"pack.FC="<<pack.FC<<endl;
cout<<"pack.DS="<<pack.DS<<endl;
cout<<sizeof(packet);
return 0;
}
please hel p me..
bye
seshu