Hi i have a struct with same type memebers in it. I am trying to convert it into uint8_t type. I am able to do that but cannot see the ouput please tell me where i am going wrong. Also I know there are another ways to do it. But i am trying to do it because i want to get use to static_cast and reinterpret_cast.
Thank You !!! Codes are below
int main()
{
struct xs{
bool x :1 ;
bool y :1;
bool z :1;
uint8_t num :5;
} zs;
uint8_t* P = static_cast<uint8_t*>(static_cast<void*>(&zs));
cout << *P << endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire