Reputation: 45
I'm reading up on a question where someone answered: Assembly language - third element points to
They mentioned The string at position 0x4024FFA4 reads 43 4F 4D 50 55 54 45 52 00 which when interpreted as ASCII can be decoded to "COMPUTER". Notice that the byte order at each address means we have to read the bytes right to left.
I'm trying to see how they got 0x4024FFA4 to 43 4F 4D 50 55 54 45 52 00. I'm not sure how they did it. I was able to get hex code to computer using the asci table. but I can't figure out what the string code is
Upvotes: 0
Views: 150
Reputation: 9466
It is really simple. There is no way you can get from pointer (0x4024FFA4) to characters without observing the running program or at least disassembled code (if string is stored at static location).
But generally if you have:
char *mystring;
Then examining mystring in gdb for example, will print pointer, which can be anything (but in their case it was the above address). From there, you get to letters by examining bytes at printed location and following addresses ((char)0x4024FFA4, (char)0x4024FFA5, and so on).
Added: In a post you linked, you see first column shows memory at address 0x4024FFA4. So you just go there and read characters there.
Upvotes: 1