I'm writing a program to store information about students using structures. We store the information in a binary file. I am getting some compiler errors using the unix machines at school. I can't see the errors that it is giving me. Any help would be greatly appreciated.
Here are the errors:
project2.c:15: two or more data types in declaration of `student'
project2.c: In function `student':
project2.c:34: parse error before ';' token
project2.c: In function `delete':
project2.c:58: `rec' undeclared (first use in this function)
project2.c:58: (Each undeclared identifier is reported only once
project2.c:58: for each function it appears in.)
project2.c: In function `print':
project2.c:108: warning: assignment makes integer from pointer without a cast
project2.c:109: request for member `print' in something not a structure or union
project2.c:135:2: warning: no newline at end of file


Here is my code:
Code:
#include <stdio.h>

FILE *f;
/*Struct rec will be the student format*/
struct rec 
{	
	long id;
	char name[30];
	unsigned char age;
	unsigned char t1, t2, t3;
	unsigned char p1, p2, p3, p4, p5;
	unsigned int sex:1;
	unsigned int class:3;
}
/*Function for writing student information at beginning semester*/
void student()
{
	int number, i,j;
	printf("How many total students?\n",number);
	struct rec r[number];
	
	for( i=0; i<number; i++)
	{	
		printf("Student number %d, enter name\n",i);
		fgets(r[i].name,30,stdin);
		fflush(stdin);
		printf("Enter id\n");
		scanf("%d\n",&j);
		fflush(stdin);
		r[i].id=j;
		printf("Enter age\n");
		scanf("%d\n",&j);
		fflush(stdin);
		r[i].age=j;
		printf("Enter 0 for male, 1 for female\n");
		scanf("%d\n",&j;
		fflush(stdin);
		r[i].sex=j;
		printf("Enter 0 - Freshman, 1 - Sophmoore, 2 - Junior, 3 - Senior\n");
		scanf("%d\n",&j);
		fflush(stdin);
		r[i].class=j;
		fwrite(&r[i], sizeof(struct rec),1,f);
	}
	
	

}
/*Function to delete a student from the list*/
void delete()
{
	int ret, i,j,std;
	/*use rec zero as a blank record to overwrite student*/
	struct rec zero; 
	printf("How many students to delete?\n");
	scanf("%d\n",&i);
	fflush(stdin);
	for (j=0;j<i;j++)
	{	printf("Enter student number\n");
		scanf("%d\n",&std);
		fflush(stdin);
		ret= fseek(f,std*(sizeof(rec)),SEEK_SET);
		fwrite(&zero,sizeof(struct rec),1,f);
	}
		
}
/*Function to input scores for students*/
void score()
{
	int ret, i, j,std;
	struct rec test[50];
	printf("How many students?\n");
	scanf("%d\n",i);
	fflush(stdin);
	for(j=0;j<i;j++)
	{
		ret= fseek(f,0,SEEK_SET);
		fread(&test[i],sizeof(struct rec),1,f);
	}
	for(j=0;j<i;j++)
	{	
		printf("Enter student number\n");
		scanf("%d\n",&std);
		fflush(stdin);
		fread(&test,sizeof(struct rec),1,f);
		printf("Enter test scores, then project scores\n");
		scanf("%d %d %d %d %d %d %d %d",&test[i].t1,&test[i].t2,&test[i].t3,&test[i].p1,&test[i].p2,&test[i].p3,&test[i].p4,&test[i].p5);
		fflush(stdin);
	}
	for(j=0;j<i;j++)
	{	
		ret= fseek(f,0,SEEK_SET);
		fwrite(&test[i],sizeof(struct rec),1,f);
	}
}
/*Function used to print current class information*/
void print()
{
	int ret, std, i;
	char s;
	struct rec print[50];
	printf("%-11d %-32d %-7d %-5d %-5d %-13d %-22d\n","   ID","       Name","Class","Sex","Age"," T Scores","   P Scores");
	printf("---------  ------------------------------  -----  ---  ---  -----------  --------------------  \n");
	printf("Enter number of students\n");
	scanf("%d\n",&std);
	fflush(stdin);
	ret= fseek(f,0,SEEK_SET);
	for(i=0;i<std;i++)
	{
		fread(&print[i],sizeof(struct rec),1,f);
	}
	for(i=0;i<std;i++)
	{
		s = print[i].sex==0?"M":"F";
		printf("%-11d %-32s %-7d %-5d %5c %-4c %-4c %-4c %-4c %-4c %-4c %-4c %-4c\n",print[i].id,print[i].name[30],print[i].class,s,print[i].age,print[i].t1.print[i].t2,print[i].t3,print[i].p1,print[i].p2,print[i].p3,print[i].p4,print[i].p5);
	}
}
main()
{
	int choice;
	f = fopen ("record","rwtb");
	printf("Choose option by number,\n1 - Enter student information\n2 - Enter test or program scores\n3 - Print class report\n4 - Delete Students\n");
	scanf("%d\n",&choice);
	fflush(stdin);
	switch(choice)
	{	case 1: student();
			break;
		case 2: score();
			break;
		case 3: print();
			break;
		case 4: delete();
			break;
	}
	fclose(f);


}