Practical 3
Practical 3
deallocation:
#include <iostream>
int main() {
cout << "Dynamically allocated integer: " << *num << endl;
delete num;
int n;
cin >> n;
cout << "Enter " << n << " elements for the array:" << endl;
delete[] arr;
return 0;
Explanation:
4. Safety:
Output Example:
12345
The elements of the array are: 1 2 3 4 5