Sumit Sharma
Sumit Sharma

Reputation: 23

How to convert Hex array's single element to int

I have a hex value stored in a two byte array :

unsigned char hex[2] = {0x84, 0xA5};

How can I convert only first element of an array to a decimal value, i.e hex[0] to int ?

Upvotes: 0

Views: 264

Answers (1)

alk
alk

Reputation: 70931

Just assign it:

int i = hex[0];

Upvotes: 1

Related Questions