Q:

Struct defined but compiler claiming it isn't

I've started learning C. I wanted to learn how to use the ncurses library and found a 'tutorial' that was more of an instruction by example type.
http://xn--ncoder-9ua.dk/blog/2010/04/using-ncurses-in-c-for-text-user-interfaces-featuring-xcode/
In the tutorial, there is a struct defines with the code:
typedef struct Snakepart {
          int x;
          int y;
} Snakeypart;

Then I get this error when I try to compile:
snake.c:47:9: error: member reference base type 'Snakeypart [40]' is not a
  structure or union

Which refers to this line of code:
snakey.x = sbegx + i;

The variable snakey is defined earlier within main() using the code:
Snakeypart snakey[SNAKEY_LENGTH];

I don't understand why I'm getting the error when the structure has been defined. I'm fairly new to programming in C, but I understand some concepts that are beyond my ability to code, so don't be afraid to get a little technical if necessary. Thanks.

A:

You need to call an element in your array.
For instance:
snakey[0].x = sbegx + i;

When you create snakey using snakey[SNAKEY_LENGTH];, your program creates an array of SNAKEY_LENGTH structures.
You can access the j-th structure in your array by using snakey[j].

