Where did you get this program? You have a number of issues. This function definition,
Code:
getline(s, lim)
char s[];    <---- here and
int lim;      <---- here
{
	int c, i;
	...
is an ancient way to specify the parameter types. I'm not sure it's even supported by the standard. Do it like you do the rest:
Code:
int getline (char s[], int lim)
{
    int c, i;
    ....
Now, as to your first error message. "index" is neither defined nor declared before you call it. A C compiler will therefore assume that it takes an int argument and returns an int. You need to either move the definition up before main or put a declaration (prototype) before main, like this:
Code:
int index(char s[], char t[]);
Your second error pertains to the same thing. The compiler has assumed it takes an int and returns an int, so when it finds the definition, it sees a second form and flags the conflict.

You also need to move 'getline' above main, or add a prototype above main.

The compiler does not make multiple passes. It does not read through the file to find the definitions, then read through it again to compile it. Forms must be known in advance.

Now, since this is C, the compiler will also assume that main returns an int, so the code is okay. However, when you move to C++, if you ever do, you will find stronger type safety. Nothing is assumed. You have to specify the return types. Since that's also the preferred way, in C, you should develop the habit now.
Code:
int main (void) // for C
or
int main () // for C++
Again, if you don't use the void keyword in C, the compiler will assume it's an int. In C++, the absence of an argument means void.

Last edited by DaWei; 25Sep2007 at 17:29..