【发布时间】:2013-06-11 03:59:54
【问题描述】:
我想访问指向结构的指针数组的元素,但我不知道如何访问它。
#include<stdio.h>
int main()
{
struct hash
{
int pages;
int price;
};
struct hash *h[5]={1,2,3,4,5};//array of pointer to structure
printf("value =%d\n",h->pages);
// want to access and also tell me how to data will be write
}
How we will access the element I tried it through pointer but it's showing error
【问题讨论】:
-
这 1. 无法编译,2. 没有任何意义,3. 难以理解且不完整:“它显示错误”甚至对任何试图回答您的问题的人都没有帮助。
-
2.5 年的 C 语言经验? o_0
-
散列结构的指针必须指向散列结构或散列结构的指针。您将指针值设置为 1,2,3,4,5,它们只是可以在内存中任何位置的数据。