linux程序语法错误
这个程序调试出现了一系列问题,不知道怎么更正语法错误啊//head.h
1 #ifndef HEAD_H
2 #define HEAD_H
3 char *fgets_(char *,int,FILE *);
4 #endif
//main.c
1 #include "stdio.h"
2 #include "head.h"
3
4 main()
5
6 {
7 char *a[10];
8 printf("%s",fets_(a,10,stdin));
9 }
//fgets_.c
1 #include"string.h"
2 #include"head.h"
3
4 char *fgets_(char *dest,int num,FILE *fp)
5 {
6 int i;
7 int ch;
8
9 for(i=0;i<num-1;i++)
10 {
11 ch=getc(fp);
12 *(dest+num-1)='\n';
13 if(ch!='/n')
14 *(dest+i)=getc(fp);
15 else return dest;
16
17 }
18
19 return dest;
20
21 }
gcc main.c fgets_.c head.h后出现下面错
[apple@localhost program]$ gcc main.c fgets_.c head.h
In file included from fgets_.c:2:
head.h:3: error: syntax error before "FILE"
fgets_.c:4: error: syntax error before "FILE"
fgets_.c: In function `fgets_':
fgets_.c:9: error: `num' undeclared (first use in this function)
fgets_.c:9: error: (Each undeclared identifier is reported only once
fgets_.c:9: error: for each function it appears in.)
fgets_.c:11: error: `fp' undeclared (first use in this function)
fgets_.c:12: error: `dest' undeclared (first use in this function)
fgets_.c:13:10: warning: multi-character character constant
head.h:3: error: syntax error before "FILE"
[apple@localhost program]$