Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C++ Programming
»
Objects and Classes
What will be the output of the following program? #include
class Tab { public: int x; }; int main() { Tab *p = new Tab(); (*p).x = 10; cout<< (*p).x << " " << p->x << " " ; p->x = 20; cout<< (*p).x << " " << p->x ; return 0; }
10 10 20 20
Garbage garbage 20 20
10 10 Garbage garbage
Garbage garbage Garbage garbage
Show Answer
Correct Answer:
10 10 20 20
← Previous Question
Next Question→
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment