LPCWSTR Parts[] = { _T("AAAA"),_T("BBBBBBB"),_T("CCCCCC") };
int c;
c = sizeof(Parts)/ sizeof(Parts[0]);
//c=3,計算正確
如果作為引數的話就計算不出來正確的字串個數。
LPCWSTR Parts[] = { _T("AAAA"),_T("BBBBBBB"),_T("CCCCCC") };
test(Parts) //作為引數傳遞進去
//函式定義
test(LPCWSTR Parts[])
{
int c;
c = sizeof(Parts)/ sizeof(Parts[0]); //總是等于1。
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/284824.html
標籤:C++ 語言
上一篇:求問這段代碼怎么敘述運行程序
