这代码在哪声明了自定义函数?解决方法

这代码在哪声明了自定义函数?
C/C++ code
#include <stdio.h>

int main()
{
   int a,b,s;
   printf("please input a:\n");
   scanf("%d",&a);
   printf("please input b:\n");
   scanf("%d",&b);
   s=max(a,b);
   printf("the max number is %d\n",s);
   getch();

}
int max(int x ,int y)                /*定义一个函数。*/
{
   if(x>y)                        /*如果x大于y就返回x。*/
   {
      return(x);
   }
   else                        /*否则就返回y。*/
   {
      return(y);
   }
}


上面不是没有声明自定义函数吗?若有,哪行是?
编译运行却正常通过。


------解决方案--------------------
1. C里面若没有看到函数声明,就使用的情况,就会根据参数的类型,自行构造一个与参数类型相同,假定返回int的函数声明。然后你下面实现了一个此原型的函数,编译成功。

2. C++编译错误

3. 若你的max函数的返回类型不是int,就会出错
------解决方案--------------------
C/C++ code

test.c(10) : warning C4013: “max”未定义;假设外部返回 int //看这行
test.c(12) : warning C4013: “getch”未定义;假设外部返回 int
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.