Back to Main Page | |||||
Favorite Sites | Computing | Education |
News | Jobs | Israel |
Business | W3 Resources | History | Travel | Internet | Russia |
Entertainment | Books | Art | Science | Languages | Spanish |
enum { NUM_TURNS = 5 }; | // "the enum hack" — makes |
// NUM_TURNS a symbolic name for 5 | |
int scores[NUM_TURNS]; | // fine |
... |
typedef string AddressLines[4]; | // a person's address |
// has 4 lines, each of which is a string | |
... | |
string *pal = new AddressLines; | // note that "new AddressLines returns a string*, just like new string[4] would |
delete pal; | // undefined behavior!!!! |
... | |
delete [] pal; | // fine |