|
-
April 23rd, 2003, 07:50 AM
#1
Regarding structure size
#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
make it possible
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|