结构体定义
下面三个那个正确?为什么?
一个是:
struct {
struct{
struct {
double x,y,z;
double rms;
char residue[8];
char name[8];
int number;
int resnum;
int selected;
} ATOM[MAXS];
int atoms;
char residue;
int residueno; /
} RESIDUE;
double xcen,ycen,zcen;
int atoms;
char filename[800];
//char residue;
int residueno;
} molecule;
另一个是:
typedef struct {
struct {
double x,y,z;
double rms;
char residue[8];
char name[8];
int number;
int resnum;
int selected;
} atm[MAXATMS];
struct{
int atoms;
char residue; /
//int number;
int residueno;
}RESIDUE;
double xcen,ycen,zcen;
int atoms;
char filename[800];
char residue;
int residueno;
}molecule;
第三个是:
typedef struct {
double x,y,z;
double rms;
char residue[8]; //
char name[8];
int number;
int resnum;
int selected;
}ATOM[MAXS];
typedef struct{
ATOM *atom;
int atoms;
char residue;
int residueno;
}RESIDUE;
typedef struct{
RESIDUE *residue;
double xcen,ycen,zcen;
int atoms;
char filename[800];
int residueno;
}molecule;
------解决方案--------------------
定义没错 是你引用错误。你应该是用的第三种方式。试试这个呢 molecule.residue->atoms = 1
------解决方案--------------------
除第一种外,其他的根据具体需求来确定