samedi 31 décembre 2016

How to 'new' a stucture using another pointer inside a differnt structure

I have a code like this: struct Pass { string fname , lname; };

struct T {
    Pass* p;
};

int main(int argc, char** argv) {
    T* t;
    t = new T[5];
    t[4].p = new Pass [3];
    return 0;
}

When I run it, STOP WORKING was only result; no errors, no text in console. OS Win7 / IDE Codelite / Debugger GNU gdb

Aucun commentaire:

Enregistrer un commentaire