+ 1

which of following statements are correct for accessing x?

class test{ public: int x=9; }; test t ; test *p=&t; options- a) p.x b) t->x c) p->x d) t.x

18th Feb 2018, 6:31 AM
Rinky Gupta
Rinky Gupta - avatar
2 Answers
+ 3
Since this appears to be C++, options (c) and (d) are the correct answers. With an object, use the dot (.) operator to access an object member directly. With a pointer, use the arrow (->) operator to dereference the pointer to access the member.
18th Feb 2018, 7:50 AM
David Carroll
David Carroll - avatar
+ 2
u know u can see the answer of the quiz question if u want just tap on " view correct answers"
18th Feb 2018, 6:59 AM
Hack Erer
Hack Erer - avatar