c++ - segment fault when assigning a new allocated memory to a struct pointer -


struct student { public:     string name;     string family;     string stdno;     string ncode;     float average;     float age;     struct student *fl; } *start, *cur, *p;  p = new struct student;     cur->fl = p;     p->fl = null; // p->fl = nullptr in c++11     cur = p; 

i try assigning new memory allocated structure pointer,it seems there no issue segment fault when cur->fl = p; ran, doing wrong here ?

cur has not been assigned point to

cur = p;

needs before p->fl


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -