mag rat wrote: > Greetings > > I am currently working on an assignment for my C > programming class and I run onto a compilation error > on my mac that I cannot resolve. I send the code to > my professor who was able to compile and run it > successfully using microsoft visual studio. > I am including a copy of the program and the > compilation error I received in the hope that someone > can help me resolve what appear to be a compiler > related problem: > > include <stdio.h> > #define CSIZE 4 This line here is a bit of a problem. > void getScore(struct student stuArray[], int n); You havent declared the struct you are using in the function definition. Move the declaration down after the struct declarations. > > struct name { > char fname[20]; > char lname[20]; > }; > > struct student{ > struct name fullname; > float grade[3]; > float average; > }; > > int main(void) > { > struct student stuArray[CSIZE] = {{{"Joey", > "Benitez"},0,0,0,0}, > {{"Dan", > "Wilson"},0,0,0,0}, > {{"Sam", > "Parker"},0,0,0,0}, > {{"Kareen", > "White"},0,0,0} }; > > getScore(stuArray, CSIZE); > } > void getScore(struct student stuArray[], int n) > { > int status = 0; > int i; > > for( i = 0; i <= CSIZE; i++) > { > printf("Enter the three scores for %s > %s\n", stuArray[i].fullname.fname, > stuArray[i].fullname.lname); > } > > } > > > i compile the program using the following command: > > cc -o assig5 assig5.c > You might want to turn on gcc's very good error checking and use something like: cc -ansi -pedantic -Wall -o assig5 assig5.c gcc would have told you pretty accurately, what was wrong in your code with these added options. > and got the following errors > > assig5.c: In function `main': > assig5.c:23: warning: passing arg 1 of `getScore' from > incompatible pointer type > assig5.c: At top level: > assig5.c:26: error: conflicting types for `getScore' > assig5.c:3: error: previous declaration of `getScore' > >