+ 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
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.
+ 2
u know
u can see the answer of the quiz question if u want
just tap on " view correct answers"