Convert array of numbers into single Hex value in c -


using 'c' program

i want convert array of numbers single hex value , array mentioned below.

input: `unsigned char no_a[12] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x01,0x02,0x03};

the single number formed above array 123456789123. it's hex equivalent is0x1cbe991a83`.

expecting output : unsigned char no_b[5] = {0x1c,0xbe,0x99,0x1a,0x83};

i have implemented logic creating single number(123456789123) in long long 64bit(8byte) variable. have restriction without 64bit variable. have idea implement this........?

thanks....

you can solve using 'long arithmetic': represent integers arrays of digits.

converting base-16 require implementing division operation.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -