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...
User Profile
Collapse
-
Schkhan started a topic type casting a pointer (to a structure) to a pointer (to a different structure)in Ctype 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...
No activity results to display
Show More
Leave a comment: