Q2.probelm

Q.2. is there any reason we can write

1
2
3
4
5
6
  int numItems; 
	cout << "how many items?"; 
	cin >> numItems; 
	int *arr = new int[numItems]; 
	delete [] arr;//over here
        delete arr[];//doesn't work 
Because the [] on line 5 is part of the name of the delete[] operator, it would be like writing the first half of a function name before the argument and the second half after:
5
6
deleteArray(arr);
delete(arr)Array; //nonsense 
Last edited on
Topic archived. No new replies allowed.