[問題] C++ 陣列問題
#include <iostream>
#include <cstdlib>
using namespace std;
int main(void)
{
int a[]={1,2,3};
cout << "a=" << a << endl;
char b[]="David";
cout << "b=" << b << endl;
system("pause");
return 0;
}
==================================
執行結果為:
a=0x22ff60
b=David
==================================
我的疑問是int a[] 輸出的是陣列起始位址
而char b[] 輸出的為何不是位址呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.99.99
→
09/13 18:44, , 1F
09/13 18:44, 1F
推
09/13 18:50, , 2F
09/13 18:50, 2F
推
09/13 19:37, , 3F
09/13 19:37, 3F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
2
3
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章