home *** CD-ROM | disk | FTP | other *** search
- // ex03002.cpp
- // the C++ free store: new and delete with an array
- #include <iostream.h>
-
- main()
- {
- int *birthday = new int[3]; // get memory for a date array
- birthday[0] = 6; // assign a value to the date
- birthday[1] = 24;
- birthday[2] = 1940;
- cout << "I was born on " // display the date
- << birthday[0] << '/'
- << birthday[1] << '/'
- << birthday[2];
- delete birthday; // return memory to the free store
- }