Hi all,
my code as shown below is the beginning of a lottery program, 20 players each with a tag number are assigned 3 numbers between 1 and 10. this is just the first portion of the program. First question I've defined a pointer to the first struct in the array (I hope thats what Ive done) and then passed this pointer to the functions getname and showname, in each function to enable me to cycle through the structures in the array Ive used ptr++. What I'd rather do is

ptr[i]->name or

(*ptr[i]).name

my compiler tells this that this is silly nonsense and although I can't find anything to the contrary in FAQ's, Tutorials, books, searchs etc.I would be suprised if its not possible. I can find plenty on stuctures, plenty on arrays of structures, and also pointers to structures but very little on pointers to arrays of structures.

Thank you in advance for any help, links to info etc.


PS is it possible to create a for instance 3 element array and copy that directly into another 3 element array within a structure. yes or no will do because Ive not attempted this yet







Code:
#include<stdio.h>
#include<stdlib.h>

#define NUMOFPLAYERS 3

        typedef struct{
                       char name[15];

                       int tag;           /*Structure definition*/

                       int numbers[3];

                       }PLAYER;

void getname(PLAYER *ptr);

void showname(PLAYER *ptr);     /* Function Prototypes  */

          int main(void)
          {
          	int s,i;

          	PLAYER *ptr;   /*Declare pointer to structure*/

          	PLAYER bob[NUMOFPLAYERS]; /*Declare array of structures*/

          	ptr = bob;     /*Make pointer point to first struct in array*/

          	getname(ptr); /*Call function to input names*/

          	showname(ptr);

          	printf("player 1 = %s\n\n",bob[0].name);  /*These three lines check to*/

          	printf("player 2 = %s\n\n",bob[1].name);  /*ensure the functions did  */

          	printf("player 3 = %s\n\n",bob[2].name);  /*their job*/

          	scanf("%d",&s);

          }
void getname(PLAYER *ptr)
{
     int i;

     for(i=0;i<NUMOFPLAYERS;i++)
   	  {
     		printf("please enter name for player no %d \n\n",i);

     		scanf("%s",ptr->name);

     		ptr->tag = i+1;

     		ptr++;

	  }

}

 void showname(PLAYER *ptr)
{
     int i;

     for(i=0;i<NUMOFPLAYERS;i++)
     {
     		printf("the name for player no %d is %s the tag no is %d\n\n",i,ptr->name,ptr->tag);

     		ptr++;


     }
}