Simple c program to read in input and display output won't compile in VS-08
Code:
#include <stdio.h>
#define MAXLINE 1000
int getline(char line[], int)
int main()
{
int c, length;
char line[MAXLINE];
while((length = getline(line, MAXLINE)) > 0){
printf("%s",line);
}
getch();
return 0;
}
int getline(char s[],int lim)
{
int i = 0;
int c;
while((c = getchar()) != EOF && c != '\n' && i < lim-1){
s[i] = c;
i++;
}
if (c == '\n'){
s[i] = c;
i++;
}
s[i] = '\0';
return i;
}
I don't see what's wrong with this. Thanks for the help.