Quote:
Originally posted by Xiangbuilder
cout<<"&s1.c="<<&s1.c<<endl
}
[root@localhost a_pointers]#[/code]Thank you. [/B]
|
c is a char, so &s1.c is interpreted like char* and cout think that it has to write a string (char*) and it so this.
int * a = new int;
cout << a << endl; // put the address of a (int*)
char * s = "i'm a string";
cout << s << endl; // put a string, not the address of s;
So if U want to get the address,
U need to write cout << (int*)(&s1.c) << endl;