0
由于某种原因,我无法访问procNames.count。我需要做的就是增加计数器。我不知道为什么。任何人都看到了问题?访问结构的副本。我得到的错误:请求成员“计数”的东西不是结构或工会
struct config_line {
char name[MAX_WORD];
int time;
};
struct config {
struct config_line *lines;
int count;
};
//global variable
struct config configData;
// allocate memory to procNames
procNames = malloc(sizeof(struct config));
if (procNames == NULL) {
printf("problem allocating memory, for procNames. int procnanny(void)");
return 0;
}
//local variable
struct config *procNames;
procNames = &configData;
// the problem
procNames.count++;