|
不知道错在哪里,请大家帮看看。
1 #include "ourhdr.h"
2 #define TOK_ADD 5
3 void do_line(char *);
4 void cmd_add(void) ;
5 int get_token(void);
6 int main(void)
7 {
8 char line[MAXLINE];
9 while(fgets(line,MAXLINE,stdin) != NULL )
10 do_line(line);
11 exit(0);
12 }
13 char *tok_ptr /* global pointer for get_token() */
14 void
15 do_line(char *ptr) /* process one line of input */
16 {
17 int cmd;
18 tok_ptr=ptr;
19 while ((cmd=get_token()) >0) {
20 switch(cmd) { /* one case for each command */
21 case TOK_ADD:
22 cmd_add();
23 break;
24 }
25 }
26 }
27 void
28 cmd_add(void)
29 {
30 int token;
31 token=get_token(); /* rest of processing for this command */
32 }
33 int
34 get_token(void)
35 {
36 /* fetch next token from line pointed to by tok_ptr */
37 }
R# gcc -c 7-3.c
7-3.c:14: syntax error before "void"
7-3.c: In function `do_line':
7-3.c:18: `tok_ptr' undeclared (first use in this function)
7-3.c:18: (Each undeclared identifier is reported only once
7-3.c:18: for each function it appears in.) |
|