头文件包含了你要调用的函数声明,宏定义,数据结构定义
来源:百度知道 编辑:UC知道 时间:2024/06/02 20:33:53
谁能举个具体的例子?这个例子里要有函数声明宏定义和数据结构定义
刚学编程几天,说详细点吧。不给我面子也得给100分面子吧。
刚学编程几天,说详细点吧。不给我面子也得给100分面子吧。
//common.h
#ifndef __COMMON__
#define __COMMON__
#define BOOL int
#define TRUE 1
#define FALSE 0
typedef struct _POINT
{
int x, y;
} POINT;
int max(int a, int b, int c);
int min(int a, int b, int c);
#endif
example.cpp
#include "common.h"
#include <stdio.h>
int max(int a, int b, int c)
{
// do something
}
int min(int a, int b, int c)
{
// do something
}
int main()
{
printf("Hello World\n");
return 0;
}
//common.h
#ifndef __COMMON__
#define __COMMON__
#define BOOL int
#define TRUE 1
#define FALSE 0
typedef struct _POINT
{
int x, y;
} POINT;
int max(int a, int b, int c);
int min(int a, int b, int c);
#endif
example.cpp
#incl