hey is it possible to create a pointer that points a struct value, like

struct person{
       int name;
       int age;
};
person me;

person *ptr = me.name;

any suggestions on how to do this?

Recommended Answers

All 2 Replies

Same as any other pointer,

person *ptr = &me;
int *nptr = &me.name;

thanx :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.