I keep getting this error when I try to compile, the program is an assignment so the way it's being done isn't the smartest (I'd use classes but my professor wants is to be done using structs) here's the code and the error if anybody can see what is wrong...because I can't thanks.
the error:c:\windows\desktop\person2\person.c(8) : error C2059: syntax error : 'PCH creation point'
also a warning:c:\windows\desktop\person2\person.c(46) : warning C4013: 'fill' undefined; assuming extern returning int
Error executing cl.exe.
here's the code:
#include <stdio.h>
#include <stdlib.h>
#include "person.h"
void fill(struct person* P)
{
printf("Please enter the name: "
scanf("%s", &P->First);
printf("Please enter the last name: "
scanf("%s", &P->Last);
printf("Please enter the address: "
getchar();
gets(P->Address);
printf("Please enter the city: "
scanf("%s", &P->City);
printf("Please enter the state: "
scanf("%s", &P->State);
printf("Please enter the zip: "
scanf("%s", &P->Zip);
}
void display(struct person P)
{
printf("%s\n", P.First);
printf("%s\n", P.Last);
printf("%s\n", P.Address);
printf("%s\n", P.City);
printf("%s\n", P.State);
printf("%s\n", P.Zip);
}
int main(void)
{
struct person P;
fill(&P);
display(P);
exit (1);
}
and here's the code for person.h
/* structure for person program */
#define NSIZE 20 /* Maximum name length */
#define ASIZE 30 /* maximum address lenght */
#define CSIZE 25 /* maximum city & state length */
#define ZSIZE 10 /* maximum zip code length */
struct person
{
char First[NSIZE];
char Last[NSIZE];
char Address[ASIZE];
char City[CSIZE];
char State[CSIZE];
char Zip[ZSIZE];
}
the error:c:\windows\desktop\person2\person.c(8) : error C2059: syntax error : 'PCH creation point'
also a warning:c:\windows\desktop\person2\person.c(46) : warning C4013: 'fill' undefined; assuming extern returning int
Error executing cl.exe.
here's the code:
#include <stdio.h>
#include <stdlib.h>
#include "person.h"
void fill(struct person* P)
{
printf("Please enter the name: "
scanf("%s", &P->First);
printf("Please enter the last name: "
scanf("%s", &P->Last);
printf("Please enter the address: "
getchar();
gets(P->Address);
printf("Please enter the city: "
scanf("%s", &P->City);
printf("Please enter the state: "
scanf("%s", &P->State);
printf("Please enter the zip: "
scanf("%s", &P->Zip);
}
void display(struct person P)
{
printf("%s\n", P.First);
printf("%s\n", P.Last);
printf("%s\n", P.Address);
printf("%s\n", P.City);
printf("%s\n", P.State);
printf("%s\n", P.Zip);
}
int main(void)
{
struct person P;
fill(&P);
display(P);
exit (1);
}
and here's the code for person.h
/* structure for person program */
#define NSIZE 20 /* Maximum name length */
#define ASIZE 30 /* maximum address lenght */
#define CSIZE 25 /* maximum city & state length */
#define ZSIZE 10 /* maximum zip code length */
struct person
{
char First[NSIZE];
char Last[NSIZE];
char Address[ASIZE];
char City[CSIZE];
char State[CSIZE];
char Zip[ZSIZE];
}