From uint8[6] to uint32

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

How could I convert variable uint8 rampasskey[6] = {1,2,3,4,5,6}; to uint32 rampasskey = 123456; ?

Thank you,

Asier.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Something like

int ii;

uint32 rampasskey = 0;

uint8 KeyARRAY[6];

for(ii = 5; ii >= 0:ii--)

{

     rampasskey *= 10;

     rampasskey +=  KeyARRAY[ii];

}

Happy coding

Bob

View solution in original post

1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Something like

int ii;

uint32 rampasskey = 0;

uint8 KeyARRAY[6];

for(ii = 5; ii >= 0:ii--)

{

     rampasskey *= 10;

     rampasskey +=  KeyARRAY[ii];

}

Happy coding

Bob