C++中字符串数组如下char a[]="hello word"; cout<<a<<endl; cout<<&a<<endl; cout<<(void *)a<<endl;

2025-05-15 19:52:32
推荐回答(1个)
回答(1):

a为字符数组,数组名a代表的存储单元首地址,每个存储单元存储一个字符,如首单元地址为1100,此单元存放字符h,1101单元则存储字符e,以此类推,1110单元存储字符串结束符\0。
cout<cout<<&a 表示输出数组 同上a的首地址
cout<<(void *)a