比较两值代码,,按照书上程序写的c语言

报错undefined reference to `max(int, int)' collect2.exe: error: ld returned 1 exit status
一直报错我也不知道,照着书上敲的。

#include <stdio.h> 
int main(){
       int max(int x,int y);
    int a,b,c;
    scanf("%d%d",&a,&b);
    c =max(a,b);
    printf("max=%d",c);
}

你少了自定义的max(int x,int y)函数实现。

#include <stdio.h> 
int main(){
    int max(int x,int y);
    int a,b,c;
    scanf("%d%d",&a,&b);
    c =max(a,b);
    printf("max=%d",c);
}

int max(int x,int y) { 
  int z; 
  if(x>y) 
    z=x; 
  else 
    z=y; 
  return(z);
}

你max的函数定义呢