Thread: Pointer to specific memory address

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Resident nerd elnerdo's Avatar
    Join Date
    Apr 2005
    Location
    Northern NJ
    Posts
    51

    Pointer to specific memory address

    Is it possible to have a pointer point to a SPECIFIC memory address? I want to be able to edit one certain address, and I'm not sure how to go about doing it.

    I would've assumed that something similar to

    Code:
    int* ptr;
    ptr = 0x83fc22;
    but it turns out that this is untrue.

    (Background info: I'm using devc++, I am a novice to the concept of pointers, but I am not a novice to programming. I generally program in .NET (vb.net and c#) and Java. )

    Do you know how or if this can be done?

    Also, another pointer question, while I'm at it: How can I get something's memory address into an int?

    As an example, let's say that I want to do something like this
    Code:
    int x;
    int y;
    y = &x; //Obviously, this won't work.  But, I want y to equal
    //something like '0x2fecd0'
    y += 5;
    //so that y can NOW equal 0x2fecd5
    cout << "Five more than the memory address of x is  "<< y;
    Last edited by elnerdo; 05-16-2006 at 08:08 PM.
    nerds unite!

    I'm using windows XP.
    I'm using dev-C++ by bloodshed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What does this do (Windows API)?
    By EVOEx in forum Windows Programming
    Replies: 4
    Last Post: 12-19-2008, 10:48 AM
  2. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  4. Memory Address
    By Stack Overflow in forum C Programming
    Replies: 5
    Last Post: 05-25-2004, 11:43 AM
  5. size of the memory reserved for a pointer
    By cris_orpi in forum C Programming
    Replies: 13
    Last Post: 03-05-2003, 11:42 AM