我有以下代码:
#include <iostream>
using namespace std;
int main()
{
int* T = new int;
T[0] = 1;
T[1] = 10;
T[2] = 100;
T[3] = 1000;
T[4] = 10000;
T[5] = 100000;
T[6] = 1000000;
T[7] = 10000000;
T[8] = 100000000;
T[9] = 1000000000;
cout << sizeof(T)/sizeof(int) << "<->" << T[3] << endl;
return 0;
}
结果给我 1 这是不正确的。如何获得正确数量的元素?