storing variables in hex format in an array

Hello,

I have the following array with 3 variables:

byte m2mdat[] = {0xAA, 0xBB, 0x06, val1, val2, val3, 0x01, 0x05};

Now, I am trying to store 3 numbers in these variables:

byte val1 = 63; byte val2 = 209; byte val3 = 7;

How can I manage to store these variables in Hex (0x ) form in the array.

(It is needed for a serial communication.. if i change the variables for exact numbers, for example: byte m2mdat[] = {0xAA, 0xBB, 0x06, 0x3F, 0xD1, 0x07, 0x01, 0x05}; then everything is working fine..)

Thanks for your help!

m2mdat[3] = val1;
m2mdat[4] = val2;
m2mdat[5] = val3;

Hex is a merely convenient way of displaying a number, as is decimal or octal if appropriate, but the underlying number will be binary. Using Hex instead of binary makes it easier for humans to interpret the value but computers don't care. So, you don't need to put the values into the array in Hex format, unless of course they are being represented by strings, which in your case is not what you want.

THX!