![]() |
#2
stop12042014-09-16 23:10
|

#include<iostream>
using namespace std;
int main()
{
char *p = "OK";
cout<< *p <<endl; //O
cout<< p <<endl; //OK
char ch[] = "OK";
cout << *ch << endl; //O
cout << ch << endl; //OK
int q[] = {1,2,3};
cout << *q << endl; //1
cout << q << endl; //0012ff34(地址值)
return 0;
为什么输出p、ch、q的结果是这样?
*p、*ch、*q的作用都是对首地址取引用?
还有,数组名到底是不是指针?
还请大家指教。