Hello All:
I want to create an array of structures like so:
#define MAX 10
struct hash_tbl {
int key;
int data;
};
struct hash_tbl hash_array[MAX], *ptr;
Now, I am having some issues in attempting to "loop" through my
array of structures and just generate the some data for the fields:
for (i=0; i<=MAX_ADDR; i++) {
sptr->key[i] = (i * 100 + 13579);
sptr->data[i] = (i * 100);
}
printf("HASH KEY:==> %d DATA:==> %d\n", sptr[k]->key,
sptr[k]->data);
Results in:
keh_hash.c:31: error: subscripted value is neither array nor pointer
keh_hash.c:32: error: subscripted value is neither array nor pointer
keh_hash.c:41: error: invalid type argument of `->'
keh_hash.c:42: error: invalid type argument of `->'
So, could someone please assist on how I would walk through the creation of my array and how to print it out.
Thanks so much....!!!!!!!!!!!!