Welcome to the forums, Ed.
First, consider the following two variable definitions. Note the location of *.
Code:
card_t *(card_table)[20]; // array of 20 pointers-to-card_t
card_t (*card_table)[20]; // pointer-to-array of 20 card_t
Next, understand that you're just declaring a pointer. This does not automagically create something for it to point to -- you have to do that yourself. Therefore you would need to do something like this:
Code:
card_t table[20]; // declare an array of 20 card_t's
card_t (*card_table)[20] = &table; // declare and define pointer-to-array of 20 card_t's
/* use it */
void assign()
{
int w=3;
(*card_table)[0].w = w; // dereference card_table to get to table, [0] to access the 1st structure and .w to get the w member of it
}
Notice the rather complex syntax for accessing members of a structure in the array. It would be much easier to go with the malloc approaches suggested above.