How to assign a hexa value to int variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to assign a hexa value to int variable

I want to assign int variable a 256 value in hexadecimal

3rd Mar 2017, 11:26 AM
suraj pandey
suraj pandey - avatar
2 Answers
+ 1
@akub thnx
4th Mar 2017, 2:09 AM
suraj pandey
suraj pandey - avatar
0
int a = 0x(insert your hex here) If you are lazy and want to output some dec to hex I'd recommend using std::hex: std::cout<< std::hex << 70;
3rd Mar 2017, 2:35 PM
Jakub Stasiak
Jakub Stasiak - avatar