This must be a very simple issue, I have a structure with four elements in it, one structure variable is initialized as an array, now the problem is I can access the first row of the array but I don't know how to access the remaining rows...please guide me!
//structure is defined as follows
typedef struct{
char first_name[100];
char second_name[100];
int x_position;
int y_position;
} names;
int main(void)
{
int i=0;
//here i have initilized structure variable
names my_data[] = {
{"First", "Row", 20, 12},
{"Second", "Row", 55, 30},
{"Third", "Row", 80, 47},
{"Fourth", "Row", 27, 34}
};
//trying to acess the diffrent row elements ....but dont know how??
for(i=0; i<=3; i++)
{
printf("%s\n",my_data->first_name);
printf("%s\n",my_data->second_name);
printf("%d\n",my_data->x_position);
printf("%d\n",my_data->y_position);
}
system("PAUSE");
return 0;
}