#include <iostream>
using namespace std;
template <int N>
void arrlength1(const char(&a)[N]) //利用模板函数得到数组长度
{
cout << sizeof(a) << endl;
}
void arrlength2(const char *a) //数组首地址进入函数后就只能得到指针大小了
{
cout << sizeof(a) << endl;
}
int main()
{
char ch[] = "hello,world";
arrlength1(ch);
arrlength2(ch);
system("pause");
return 0;
}