Hello, I am learning how to use pointers and was wanting to know how I can check if the allocated is space is being used.
here is my code :
` int main(){
int val{0};
cout << "enter a number:\t";
cin >> val;
int *p = new int[val];
cout << "[ ";
for (int i = 0; i < val; i++) {
p[i] = i+1;
cout << p[i] << " ";
}
cout << "] \n";
delete[] p;
return 0;
}`