奇怪的字符數(shù)組初始化
摘要:
今天做了一個題目,感覺字符數(shù)組的初始化有點奇怪,就親自測試了一下,果不其然。確實很奇怪。這個就要和數(shù)組區(qū)分開了。一定不能將兩者混淆了。下面給出測試的代碼,并一一解析。View Code #include "iostream"#include "string"#include "cstring"using namespace std;#define size 10int main(){ char s1[size]="1", s2[size]={0}; for(int i=0; i<10; i++) cout&l 閱讀全文
posted @ 2011-11-24 14:37 More study needed. 閱讀(654) 評論(0) 推薦(0)
浙公網(wǎng)安備 33010602011771號