码迷,mamicode.com
首页 > 其他好文 > 详细

7.23 编译预处理 Day14

时间:2016-07-23 22:58:47      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

---note---

预处理  //在编译之前

#define PI 3.14

1.宏定义:#define

2.文件包含:#include

3.条件编译:#if   #end if

一般为大写

宏定义不检查错误

当出现"  "时不再置换

不分配内存空间

#define S(a,b) a*b

  area = S(3,2)

  area = 6

一个#include 只包含一个文件

f1包含f2,f2中有static (static 在f1中也有效)

---note---

#include<stdio.h>
#define ADD(x) x+x
int main()
{
  int m=1,n=2,k=3;
  int sum=ADD(m+n)*k;
  printf("sum=%d",sum);
  return 0;
}

7.23 编译预处理 Day14

标签:

原文地址:http://www.cnblogs.com/Dying39/p/5699553.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!