A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Curry

  • one year ago

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

  • This Question is Closed
  1. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @wio

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  3. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so what would i pass in gdb?

  4. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  5. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  6. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  7. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    `(&puzzle1+20)`

  8. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    adress out of bounds

  9. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    can you give a picture

  10. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  11. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    What about +4?

  12. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    +3 did the trick.

  13. Curry
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  14. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  15. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  16. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    32 bit, could be an integer or something

  17. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  18. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.