Adreess of pointed structure element

This is a discussion on Adreess of pointed structure element within the C Programming forums, part of the General Programming Boards category; Hi all, I am trying to take the address of a pointed structure's element. I have a pointer to a ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    26

    Unhappy Adreess of pointed structure element

    Hi all,

    I am trying to take the address of a pointed structure's element.

    I have a pointer to a table_a structure in address 0x0000FFFF:

    struct table_a *rsdt = (*uint32_t) 0x0000FFFF;

    I would like to create a pointer rsdt_search that will point to a (32-bit) address
    and make it point to the address of the table_offset field of the table_a structure that is pointed by *rsdt.

    I am trying to that like following but GCC complains that there are multiple markers at the line:

    uint32_t rsdt_search* = (uint32_t)*) rsdt->table_offset;


    In other words, I don't want to make rsdt_search* to point to the beginning of the structure that is pointed by *rsdt (i.e. 0x0000FFFF) but to the 5th element of structure (i.e. 0x0000FFF + 5 Bytes).


    Any ideas?

    Thanks in advance.
    Last edited by limp; 06-12-2009 at 05:15 AM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    struct foo
    {
        int a, b, c, d, e;
    } mystruct;
    
    int *p;
    
    p = &mystruct.e;
    Something like that?


    Quzah.
    Last edited by quzah; 06-12-2009 at 05:55 AM. Reason: tired
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another Linked List plee
    By Dragoncaster131 in forum C Programming
    Replies: 3
    Last Post: 05-15-2004, 05:40 PM
  2. Structure Within Structure
    By Shakira in forum C Programming
    Replies: 3
    Last Post: 11-04-2003, 02:35 PM
  3. Binary searches
    By Prezo in forum C Programming
    Replies: 4
    Last Post: 09-10-2002, 09:54 PM
  4. Dynamic Data Structure -- Which one is better?
    By Yin in forum C++ Programming
    Replies: 0
    Last Post: 04-10-2002, 11:38 PM
  5. referencing C structure elements in assembly
    By BigAl in forum C Programming
    Replies: 7
    Last Post: 09-10-2001, 03:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21