troubleshooting Question

Addressing Question using * and &

Avatar of Mike Hagan
Mike HaganFlag for United States of America asked on
C
5 Comments1 Solution236 ViewsLast Modified:
I was asked to interprete the following C statement:
#define XY(s,m) (&((s*)0)->m)

Out of curiousity was my explanation correct:

Assumption 1: s is a structure
Assumption 2: m is a member of s

s* typecasts the "pointer to a structure s" to a "pointer to s".

The remaining "stuff" would be interpreted as:
the address of member "m" at location "s + 0 "
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros