#include <iostream>
using namespace std;
#include <stdio.h>
int main()
{
char *pstr = "china";
char *qstr = "america";
char *q = "adf";
char * s;
s = "hello";
printf("pstr = %p\n", pstr); /*輸出為字符串起始地址值*/
/*由於C++標准庫中I / O類對 << 操作符重載,因此在遇到字符型指針時會將其當作字符串名來處理,輸出指針所指的字符串。
https://blog.csdn.net/u013467442/article/details/43666955 */
cout << "pstr = " << pstr << endl; /*輸出為字符串*/
printf("pstr = %s\n", pstr); /*輸出為字符串*/
cout << "qstr = " << qstr << endl;
cout << "q = " << q << endl;
cout << "s = " << s << endl;
printf("s = %p\n", s);
return 0;
}
