Guest_imported
New member
- Jan 1, 1970
- 0
Hi, i just can`t seem to get the following code to compile properly.
these are the errors i get...any help would be greatly appreciated :=)
error C2228: left of '.identity' must have class/struct/union type
error C2228: left of '.name' must have class/struct/union type
#include <stdio.h>
#include <string.h>
#define MAX 10
typedef struct {
char name[20];
int identity;
}GOLFER;
void initial_screen(void);
void get_details(GOLFER *ptr);
void print_details(GOLFER player);
void main (void)
{
GOLFER player[MAX];
initial_screen();
get_details(&player[MAX]);
print_details(player[MAX]);
}
void initial_screen(void)
{
printf("\t*************************************************\n"
("\n\t*************************************************\n"
puts("\n\t"
puts("\tInput Players or (x) to finish input"
}
void get_details(GOLFER *ptr)
{
int i;
for(i=1;i<=10;i++)
{
printf("\n\tName : "
scanf("%s", &ptr->name);
printf("\n\tName : "
scanf("%d", &ptr->identity);
}
}
void print_details(GOLFER player[])
{
int i;
for(i=0;i<=10;i++)
printf("\n\tNAME\t\t\tID\n"
printf("%s %d",player.name,player.identity);
}
these are the errors i get...any help would be greatly appreciated :=)
error C2228: left of '.identity' must have class/struct/union type
error C2228: left of '.name' must have class/struct/union type
#include <stdio.h>
#include <string.h>
#define MAX 10
typedef struct {
char name[20];
int identity;
}GOLFER;
void initial_screen(void);
void get_details(GOLFER *ptr);
void print_details(GOLFER player);
void main (void)
{
GOLFER player[MAX];
initial_screen();
get_details(&player[MAX]);
print_details(player[MAX]);
}
void initial_screen(void)
{
printf("\t*************************************************\n"
("\n\t*************************************************\n"
puts("\n\t"
puts("\tInput Players or (x) to finish input"
}
void get_details(GOLFER *ptr)
{
int i;
for(i=1;i<=10;i++)
{
printf("\n\tName : "
scanf("%s", &ptr->name);
printf("\n\tName : "
scanf("%d", &ptr->identity);
}
}
void print_details(GOLFER player[])
{
int i;
for(i=0;i<=10;i++)
printf("\n\tNAME\t\t\tID\n"
printf("%s %d",player.name,player.identity);
}