Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- using namespace std;
- int main() {
- int *x = NULL, *y = NULL;
- x = new int[5]; // int x[5]
- y = new int(5); // *y = 5
- for (int i = 0; i < 5; i++) {
- *(x + i) = i;
- }
- for (int i = 0; i < 5; i++) {
- cout << " " << x[i];
- }
- cout << endl;
- delete []x;
- x = NULL;
- cout << *y << " is in " << y << endl;
- delete y;
- y = NULL;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement