Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 为什么';我的结构变量是否包含此成员?_C_List_Structure - Fatal编程技术网

C 为什么';我的结构变量是否包含此成员?

C 为什么';我的结构变量是否包含此成员?,c,list,structure,C,List,Structure,我编写了以下代码: #include <stdio.h> #include <stdlib.h> typedef struct { int month; int day; int hour; int minutes; }primaries_date; typedef struct { int all_members; char *country; primaries_date date; }usa_pr

我编写了以下代码:

#include <stdio.h>
#include <stdlib.h>


typedef struct 
{
    int month;
    int day;
    int hour;  
    int minutes;
}primaries_date;

typedef struct 
{
    int all_members;
    char *country;
    primaries_date date;
}usa_primaries;

typedef struct node *ptr;

typedef struct node
{
    usa_primaries up;
    ptr next;
}Node;



void add(ptr usa_primaries *hptr, int all_members, char *con, int month,     int day, int hour, int minutes)
{
    ptr p;
    ptr q;
    ptr t;
    t = malloc(sizeof(Node));
    if(!t)
    {
         printf("Cannot build list");
         exit(0);
    }

    t->all_members = members;
    t->county = con;
    t->date->month = d->month;
    t->date->day = d->day;
    t->date->hour = d->hour;

   while( (p1) )
   {
       if( p->date->month >= month || p->date->day >= day ||     p->date->hour >= hour || p->date->minutes >= minutes )
       {
            q = p;
            p = p->next;
       }
   }

   if(p == *hptr)
   {
        *hptr  = t; /*Resetting head. Assigning to the head t*/
        t->next = p; 
   }
   else
   {
       q->next = t;
       t->next = p;
   }
}


int main()
{
   ptr h;
   int month, day, hour, minutes; 
   int all_memebers; /*Declaration of all_members*/
   char *county; 
   char member;
   printf("Please enter the day");
   scanf("%d",&day);
   printf("Please enter the month");
   scanf("%d",&month);
   printf("Please enter the hour");
   scanf("%d",&hour);
   printf("Please enter the minutes");
   scanf("%d",&minutes);
   printf("Is this an all-member candidate? Y/N");
   scanf("%c",&member);
   if(member == 'Y')
     all_members = 1;
   else
     all_members = 0;
   printf("Please enter the country");
   scanf("%s",&county);

   add(&h,all_members,country,month,day,hour,minutes);

   return 0;
}
我真的不明白为什么会发生这个错误,因为所有的_成员都在结构usa_primaries中声明,而结构节点中包含结构usa_primaries


为什么会显示此错误以及如何修复它?

节点没有
所有成员。它有一个
usa\u初选
,它有
所有成员
。因此:

t->up.all_members

节点
没有
所有\u成员
。它有一个
usa\u初选
,它有
所有成员
。因此:

t->up.all_members

非常感谢你,讲故事的人!非常感谢你,讲故事的人!旁注:无意冒犯,请重新阅读C语言书中的结构和联合章节。职业训练局是打字错误,谢谢。我真的意识到那里有很多语法问题,我一直在修复它们,所以现在它编译时没有任何编译错误@苏拉夫·戈希德:当然,仅供参考,了解一下。我会的,谢谢:)@Sourav GhoshSide注意:无意冒犯,请重新阅读你的C书的结构和联合一章。职业训练局是打字错误,谢谢。我真的意识到那里有很多语法问题,我一直在修复它们,所以现在它编译时没有任何编译错误@苏拉夫·戈什当然,仅供参考,了解一下。我会的,谢谢:)@Sourav Ghosh