Hi, I am interested in implementing a lookup table in code segment as below. LUT[] = { {0x01020304, "String1"}, {0x05060708, "String2"}, {0x0b0c0d0e, "String3"}, {0x22334455, "String4"} }; How can I write a function such that if i pass the first 4-bytes data then it returns back the corresponding String from the lookup table? Any help would be great. Azra
Are there really only 4 entries in your table? If so, why not think of a 4-byte data type in C51, and just use a switch?
Frankly, if you can't solve that one yourself then you're in way over your head. This doesn't have anything to do with C51 yet. This is extremely basic C and algorithms knowledge. Get a textbook, sit down and learn how to program.
Actually that LUT[] is just an example. In reality my LUT has lot more entries. Do you think a switch-case control structure would be appropriate there ?