User Profile

Collapse

Profile Sidebar

Collapse
Schkhan
Schkhan
Last Activity: Mar 31 '08, 02:05 PM
Joined: Mar 30 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Many thanks for your reply. Let me clarify things a little bit,
    these are two completly different structures. the initial point of confustion is in the macro,
    #define TEST_MACRO(firs t) ((struct second *) &first[1])

    it essentially returns a pointer to a structure of type "second", but why they are using an index value, i mean they could have done it like
    #define TEST_MACRO(firs t) ((struct second...
    See more | Go to post

    Leave a comment:


  • type casting a pointer (to a structure) to a pointer (to a different structure)

    Hi,
    I am sturggling with a peace of code mainly its about casting a pointer to one type of structure to a pointer to another type of structure.

    the confusion begins with the following line...(modifie d to highlight the actual prob)

    #define TEST_MACRO(firs t) ((struct second *) &first[1])

    /*here it would return a pointer to second, but the question is why it uses [1]
    Here in this example...
    See more | Go to post
No activity results to display
Show More
Working...