Ask your own question, for FREE!
Computer Science 22 Online
OpenStudy (curry):

I'm using gdb, how do I get rid of these random values?

OpenStudy (curry):

@wio

OpenStudy (anonymous):

It looks like your pointer is pointing at an address that is before the actual beginning of the string.

OpenStudy (curry):

so what would i pass in gdb?

OpenStudy (anonymous):

I think the problem fundamentally is the pointer but...

OpenStudy (curry):

i can't change the original file they said. :/

OpenStudy (anonymous):

try using `(&puzzle + 20)` and see what you get

OpenStudy (anonymous):

`(&puzzle1+20)`

OpenStudy (curry):

adress out of bounds

OpenStudy (anonymous):

can you give a picture

OpenStudy (curry):

when i do &puzzle1+5, i get "is watching you"

OpenStudy (anonymous):

What about +4?

OpenStudy (curry):

+3 did the trick.

OpenStudy (curry):

ok ok, cause it was 8 bytes from T to i. ok ok. thank you! nice hint!

OpenStudy (anonymous):

I guess the type of puzzle1 isn't a char, because the pointer arithmetic is moving it far.

OpenStudy (anonymous):

it looks like it's a type that takes 4 bytes.

OpenStudy (anonymous):

32 bit, could be an integer or something

OpenStudy (anonymous):

Alternatively, you could have done something like `(((char*) &puzzle1)+12)`.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!