Quote:
Originally Posted by mscoder
sorry for not clearing it in the last post..but by adding i mean adding the two hexadecimal numbers stored in the two lists...the final list shoud contin the addition of two numbers in hexadecimal format.
|
Still not clear is what programming language you are using.
However, as far as the storage of the hex data, store it as a string of character(s). All symbols are characters, unless you opt to treat them otherwise. So "8F" is composed of the characters '8' and 'F' (and the terminating NULL character).
To perform addition of the hex data, you will need to convert the string to a number; for example, for "8F", you would convert the '8' to the number 8 and multiply by 16; for the 'F', convert this to 15 and add to the previous multiplication result. Repeat for the other value, then perform the addition of the two values. When done, reconvert to the result to a hex string representation.
In summary (pseudocode):
Code:
hexStrResult = ConvertToHexString( ConvertToNumber(hexStr1) + ConvertToNumber(hexStr2) )
P.S. Conversely, you can store all data as numbers, and only display the data in hex when requested to print the values of the linked list. This might be the easier approach.