int to byte AND operation

  • Thread starter Thread starter AMP
  • Start date Start date
A

AMP

Hello,
I am trying to do the following:
byte rxNum= 0;
byte Hdr;
rxNum = Hdr & 0x0f;

Hdr is a byte var.

I tried rxNum = Hdr &(byte) 0x0f;
but thay gives me an error.

Any help
Thanks
Mike
 
AMP said:
I am trying to do the following:
byte rxNum= 0;
byte Hdr;
rxNum = Hdr & 0x0f;

Hdr is a byte var.

I tried rxNum = Hdr &(byte) 0x0f;
but thay gives me an error.

Try:

rxNum = (byte)(Hdr & 0x0f);

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top