Thread: Pointer to address.

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    97

    Pointer to address.

    How do I make a pointer to an specific address? I want to make a pointer to 0x1000 and I don't know how.

    Thanks.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    there's probably no good reason to...but if you insist, use __asm
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    or you can use C.

    Example
    Code:
    int *addr = (int *)0x1000;
    However, I do have to ask what ever are you doing Hulag?

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    Quote Originally Posted by master5001
    or you can use C.

    Example
    Code:
    int *addr = (int *)0x1000;
    i predict a segmentation fault...


    hulag..do you want to point to 0000:1000 or DS:1000 ?
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    >i predict a segmentation fault...
    I concur, which is why i question the motives. In either case he can still use C, but I somewhat agree with the assembler suggestion to the extent that I'd be more likely to write something that directly accesses an address like that in assembler.

  6. #6
    Registered User
    Join Date
    Oct 2003
    Posts
    97
    Its just a little test. BTW, this is going to be run on a Motorola HC11, and compiled with ICC.

  7. #7
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Ah yes, ok then what I suggested should work fine. If not report back. I thought you may have been working on an embedded system.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Increment the address stored in a pointer???
    By patricio2626 in forum C++ Programming
    Replies: 9
    Last Post: 04-04-2007, 06:36 PM
  2. [beginner] get file address from file pointer
    By taisao in forum C Programming
    Replies: 14
    Last Post: 03-30-2007, 09:46 AM
  3. Should i pass address of pointer or just pointer???
    By howhy in forum C++ Programming
    Replies: 11
    Last Post: 09-02-2005, 04:05 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. Im so lost at . .
    By hermit in forum C Programming
    Replies: 18
    Last Post: 05-15-2002, 01:26 AM