#include <iostream>
using namespace std;
int main()
{
int intArray[] ={5,2,4,7,1,3,2,6};
int len = sizeof(intArray)/sizeof(intArray[0]);
int *a = new int[8];
cout<<len<<" "<<sizeof(a)<<endl;
getchar();
return 0;
}
结果:
#include <iostream>
using namespace std;
int main()
{
int intArray[] ={5,2,4,7,1,3,2,6};
int len = sizeof(intArray)/sizeof(intArray[0]);
int *a = new int[8];
cout<<len<<" "<<sizeof(a)<<endl;
getchar();
return 0;
}
结果: