第1个回答 2011-12-24
举例(程序已调试可以运行非常简单楼主有什么疑问可以交流交流):
header file:(max.h)
#ifndef MAX_NUMBER // MAX_NUMBER 为任意的
#define MAX_NUMBER // 重复定义
#include<stdio.h>
int max(int a,int b);
#endif
source file:(main.c)
#include"max.h" // 与头文件名相同
int main()
{
extern int a,b;
int ,c;
printf("Please input the value of a: ");
scanf("%d",&a);
printf("Please input the value of b: ");
scanf("%d",&b);
c= max(a,b);
printf("The max number of %d and %d is %d!\n",a,b,c);
return 0;
}
source file:(max.c)
#include"max.h" // 与头文件名相同
int a,b;
int max(int m,int n)
{
if(m>=n) {return (a);}
else { return (b); }
}本回答被提问者采纳