[問題] 小問題
#include<iostream>
using namespace std;
int main()
{
char array[]={'a','b','c','d'};
cout<<&array[0];
system("pause");
return 0;
}
抱歉~有點蠢的問題
想釐清些小觀念
我只能知道此陣列的起始位址(cout<<&array)
無法表示出各字元對應的位址嘛??
(會出現亂數)
和下比較:
#include<iostream>
using namespace std;
int main()
{
int num[]={1,2,3,4};
cout<<&num[0];
system("pause");
return 0;
}
此整數陣列就可對應出個別位址
我實在搞不懂兩者差異XD
抱歉~真是個蠢問題
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.139.150.202
推
06/19 01:01, , 1F
06/19 01:01, 1F
→
06/19 01:02, , 2F
06/19 01:02, 2F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章