我有一个
的课程class IntFile
{
public:
int value;
int *array;
}
还有我的主要
int main()
{
IntFile myfile;
myfile.array = new int[CAPACITY];
int number;
cout << "Enter number of elements: " << endl;
cin >> number;
cout << "Enter your numbers: ";
for ( int i = 0; i < number; i++)
{
cin >> myfile.value;
myfile.array[i] = myfile.value;
}
cout << endl;
int n = sizeof(myfile.array);
cout << " THE SIZE OF ARRAY IS " << n << endl;
delete[]myfile.array;
cout << endl;
return 0;
}
sizeof(array)= 4 *数组中的元素数量不应该吗? 因为对我来说,我总是得到sizeof(myfile.array)= 4
CAPACITY是全球性的,= 1000;