Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/58.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_Struct - Fatal编程技术网

C 在非结构或联盟中请求成员“自由度”

C 在非结构或联盟中请求成员“自由度”,c,struct,C,Struct,我希望用户在结构数组中输入信息,但得到4个相同类型的错误,即: request for member 'locName' in something not a structure or union| request for member 'locDesc' in something not a structure or union| request for member 'latitude' in something not a structure or union| request for m

我希望用户在结构数组中输入信息,但得到4个相同类型的错误,即:

request for member 'locName' in something not a structure or union|
request for member 'locDesc' in something not a structure or union|
request for member 'latitude' in something not a structure or union|
request for member 'locName' in something not a structure or union|
排队:

        printf("Please enter the name for the location: \n");
        scanf("%s\n", &*myArray->locName); //Gets the user input for the Location Name
        printf("Now enter the description:");
        scanf("%s\n", &*myArray->locDesc); //Gets the user input for the Location Description
        printf("Now enter the value for the latitude:");
        scanf("%lf\n", &*myArray->latitude); //Gets the user input for the Latitude
        printf("Now enter the value for the longitude:");
        scanf("%lf\n", &*myArray->longitude); //Gets the user input for the Latitude
有人能指出我在代码中犯的错误吗?注意,如果数组已满,我需要调整数组的大小


这是一个结构数组,我们需要一个索引来指定要在addInfo中添加到的特定结构,请查看此摘录中的最后一行,并将mvArrav[0]中的0替换为mvArrav[i],其中i是索引。您需要修改逻辑以通过索引

 void addInfo(LocationArray **myArray, int *count, int max){
  if(*count == max){ // Checks if the array is already full
    resizeArray(*myArray, max); //Resizes the array if it's full
  }
   else{ //Else, a used fills it out
    printf("Please enter the name for the location: \n");
    scanf("%s\n", myArray[0]->locName); //Gets the user input for the Loca

确保使用英语单词,而不是文本语言,SMB对某些人来说意味着不同的东西。试着去掉“&”。@MartinJames,很久以前尝试过,同样的事情:@MartinJames,我想我在指针方面有问题。我没有处理他们,可能每个帖子都有一个问题,所以最好不要扩展对话,但提示:仔细检查传递的类型。
 void addInfo(LocationArray **myArray, int *count, int max){
  if(*count == max){ // Checks if the array is already full
    resizeArray(*myArray, max); //Resizes the array if it's full
  }
   else{ //Else, a used fills it out
    printf("Please enter the name for the location: \n");
    scanf("%s\n", myArray[0]->locName); //Gets the user input for the Loca