Possible Duplicate:
C function syntax, parameter types declared after parameter list
I saw the following syntax for function definition in "Expert C Programming"
int compare(s1, s2)
char * s1, *s2;
{
while (*s1++ == *s2) {
if (*s2++ == 0) return (0);
}
return (*--s1 - *s2);
}
How is the above definition valid? It compiles and runs perfectly without any errors.
I am more comfortable with the following syntax for function definition
int compare(char * s1,char *s2)
{
while (*s1++ == *s2) {
if (*s2++ == 0) return (0);
}
return (*--s1 - *s2);
}
and no where I've seen the one given in the book(While studying C in my college or elsewhere), can anyone please throw some light on the one given in the book.