我从Brian Kernighan和Dennis Ritchie编写的“The C Programming Language”获得以下代码。无法获得ANSI C代码与gcc编译
#include <stdio.h>
#include <string.h>
#define MAXLINE 1000
int getline(char *line, int max);
{
char line[MAXLINE];
int found = 0;
if (argc != 2)
printf("Usage: find pattern\n");
else
while (getline(line, MAXLINE) > 0)
if (strstr(line, argv[1]) != NULL) {
printf("%s", line);
found++;
}
return found;
}
我得到的是:: 错误:但是,它不会用gcc编译。预计标识符或 '(' 前 '{'
我在做什么错
int getline(char * line,int max)',只是删除';',它会起作用 –
** **是**错误吗? *(错误信息是指特定的代码行,这将有助于缩小问题范围到代码中的特定位置)* – abelenky
*开始摆脱; after - getline(char * line,int max) –