您的位置:首页 > 其它

C程序设计语言(K&R)学习笔记--7.include,define,ifndef综合应用demo

2014-05-25 15:28 435 查看

mycommon.h

enum boolean {
			false,
			true
} status,flag;

void printIntArray(int *p,int len,int isPrint){
	int i;
	if(isPrint){
		for(i=0;i<len;i++,p++){
			printf("%d\t",*p);
		}
	}
	printf("\n");
}


test.c

#ifndef MYCOMM_FUNTION_A    

	#define MYCOMM_FUNTION_A 	
	#include <stdio.h>
	#include "mycommon.h"
	#include "test1.c"	
#endif

void main(){
	int a[]={1,2,3,4,5};
	printIntArray(a,5,true);
	add(a,5);
}


test1.c

#ifndef MYCOMM_FUNTION_A    
	#define MYCOMM_FUNTION_A
	#include <stdio.h>
	#include "mycommon.h"
#endif

void add(int *p,int len){
	printIntArray(p,len,false);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: