i am writing this code for a school poject it gives mee segmentation fault .please help
it scans iput of the form
#include<stdio.h>
#include<stdlib.h>
struct time{
int hh,mm;
};
struct date{
int day,month,year;
};
struct student{
char firstname[20];
char lastname[20];
struct time entry;
struct time leavetime;
struct date dt;
int bno;
int rno;
};
int main(void)
{
struct student stu1;
FILE *file;
file = fopen("inpt.txt", "r");
fscanf(" %s %s %2d:%2d %2d:%2d %2d/%2d/%4d %3d %3d",
stu1.firstname,stu1.lastname,&stu1.entry.hh,&stu1.entry.mm,&stu1.leavetime.hh,&stu1.leavetime.mm,
&stu1.dt.day,&stu1.dt.month,&stu1.dt.year,&stu1.bno,&stu1.rno);
fclose(file);
printf("%s %s %d:%d %d:%d %d/%d/%d %d %d",
stu1.firstnamename,stu1.lastname,stu1.entry.hh,stu1.entry.mm,stu1.leavetime.hh,stu1.leavetime.mm
,stu1.dt.day,stu1.dt.month,stu1.dt.year,stu1.bno,stu1.rno);
return(0);
}
Alex Smith 10:00 12:00 24/08/2012 342 618