#include #include class CityRec { // definition of a record public: int x; int y; char name; // Note: the type here is irrelevent, it didn't need to be char. // This is nothing but a placeholder for where the beginning of // the name will be. }; void main() { int inx = 1000; int iny = 2038; char* inname = "Blacksburg"; // reclength will be size of x, y, and name (including null terminator) int reclength = 8 + strlen(inname) + 1; cout << "Reclength is " << reclength << endl; char *dum = new char[reclength]; // defining the char array CityRec* myrecord = (CityRec *)dum; // Pointing to beginning of dum myrecord->x = inx; myrecord->y = iny; memcpy(&(myrecord->name), inname, strlen(inname)+1); cout << "X coord: " << myrecord->x << endl; // checking cout << "Y coord: " << myrecord->y << endl; cout << "Name: " << (char*)&(myrecord->name) << endl; cout << (char *)&(dum[8]) << endl; // Is it really there? } // end main