請教 C++陣列
#include<iostream>
using namespace std;
int main( )
{
char a[]={'1','2','3','4','\0'};
cout<<a<<endl;
cout<<a[0]<<endl;
cout<<&(a[0])<<endl;//這一行為何顯示1234呢?
cout<<&a<<endl;
cout<<&a+1<<endl;
cout<<a+1<<endl;//為什麼不是2 而是234呢?
system("pause");
return 0;
}
謝謝
--
┌─────◆KKCITY◆─────┐ ◢ ◤ 動態歌詞 讓你成為K歌之王!
│ bbs.kkcity.com.tw │ \^_^ / ★ http://www.kkbox.com.tw ★
└──《From:218.169.113.233 》──┘ ◤ 唱片公司授權,音樂盡情下載
--
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 4 篇):
Programming 近期熱門文章
PTT數位生活區 即時熱門文章