struct myself *pmy;只定义了一个指针,没有分配内存,后面解引用时程序就会崩溃你可以改为struct myself *pmy = (struct myself*)malloc(sizeof(struct myself));
struct myself *pmy;
struct myself *pmy = (struct myself*)malloc(sizeof(struct myself));