D
David
1 #include <iostream>
2
3 class Name{
4 public:
5 char* s;
6 };
7
8 int main(){
9 Name *t= new Name;
10 Name t1;
11
12 cout<< t->s <<endl;
13 cout<<endl<<endl;
14 cout<< t1.s <<endl;
15 }
why line 12 and 14 generate different output?
12 generate (null)
14 generate irregular output
2
3 class Name{
4 public:
5 char* s;
6 };
7
8 int main(){
9 Name *t= new Name;
10 Name t1;
11
12 cout<< t->s <<endl;
13 cout<<endl<<endl;
14 cout<< t1.s <<endl;
15 }
why line 12 and 14 generate different output?
12 generate (null)
14 generate irregular output