How to assign values to a UINT8 variable?

B

boki

Dear All,


If I have a UINT8 variable, how can I assign it as my expected value?

UINT8 a;
a=(00001001);

?


Thank you very much.

Best regards,
Boki.
 
J

John Harrison

boki said:
Dear All,


If I have a UINT8 variable, how can I assign it as my expected value?

UINT8 a;
a=(00001001);

?

Use hexadecimal

a = 0x09;

C++ does not support binary.

john
 
T

Tom Widmer

Dear All,


If I have a UINT8 variable, how can I assign it as my expected value?

UINT8 a;

The standard C++ type is unsigned char. It isn't necessarily 8 bits,
but it is on common platforms such as Windows and Linux.
a=(00001001);

?

C++ does not have binary literals. Instead the best option is to use
hex literals:

//hex
a = 0x9;
//or octal
a = 011;
//or decimal
a = 9;

Tom
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top