📅  最后修改于: 2022-03-11 14:48:37.331000             🧑  作者: Mango
#include
using std::cout;
int a[] = { 1, 2, 3, 4, 5 };
int counta()
{
return sizeof( a ) / sizeof( a[ 0 ] ); // works, since a[] is an array
}
int countb( int b[] )
{
return sizeof( b ) / sizeof( b[ 0 ] ); // fails, since b[] is a pointer
}