九九热这里直有精品,1区二区三区在线播放,玖玖爱在线观看资源,国产aⅴ综合网,午夜福利男女,日本亚洲欧美三级,日韩无码黄色导航,内射少妇13区,中文字幕高清网

您身邊的軟件定制專家--9年開發(fā)經驗為您護航

18678812288
0531-88887250

C語言條件編譯

文章作者:濟南軟件開發(fā) 時間:2016年11月08日

  C語言中的預編譯包含三種:1.宏定義2.文件包含3.條件編譯,條件編譯指的是滿足一定條件下才進行編譯,它有幾種形式:

  (1)#ifdef標識符

  //程序

  #else

  //程序

  #endif

  它的意義為如果定義了標識符,則執(zhí)行程序段1,否則執(zhí)行程序段2

  或者用以下的形式

  # ifdef 標識符

  //程序

  #endif

  1

  2

  3

  4

  5

  6

  7

  8

  9

  10

  11

  12

  13

  14

  # include <stdio.h>

  # include <stdlib.h>

  int main()

  {

  #ifdef DEBUG

  printf("debug is running\n");

  #else

  printf("debug is not running\n");

  #endif

  system("pause");

  return 0;

  }

  </stdlib.h></stdio.h>

  (2)

  #ifndef 標識符

  //程序1

  #else

  //程序2

  #endif

  它的含義是如果標識符沒有被定義,則執(zhí)行程序段1,否則執(zhí)行程序段2

  1

  2

  3

  4

  5

  6

  7

  8

  9

  10

  11

  12

  13

  14

  # include <stdio.h>

  # include <stdlib.h>

  int main()

  {

  #ifndef DEBUG

  printf("debug is not running\n");

  #else

  printf("debug is  running\n");

  #endif

  system("pause");

  return 0;

  }

  </stdlib.h></stdio.h>

  (3)#if表達式

  //程序1

  #else

  //程序2

  #endif

  它的意義為表達式的值為真時,就編譯程序段1,表達式的值為假時,就編譯程序段2

  1

  2

  3

  4

  5

  6

  7

  8

  9

  10

  11

  12

  13

  14

  15

  # include <stdio.h>

  # include <stdlib.h>

  # define HEX 1

  int main()

  {

  int i=10;

  #if HEX==1

  printf("%x\n",i);

  #else

  printf("%d\n",i);

  #endif

  system("pause");

  return 0;

  }</stdlib.h></stdio.h>


想要了解更多詳情歡迎來電咨詢18678812288
登陸網址:m.h6244.cn。
聯(lián)系人:王經理。

应用必备| 洪湖市| 大邑县| 巍山| 阜康市| 特克斯县| 陆良县| 彭州市| 南木林县| 灵璧县| 红安县| 吴川市| 平舆县| 武陟县| 界首市| 红桥区| 古田县| 从化市| 清水县| 襄垣县| 宣化县| 藁城市| 乌拉特前旗| 确山县| 方正县| 昆山市| 张家口市| 沈阳市| 汶上县| 湖口县| 刚察县| 金阳县| 兴和县| 霍邱县| 高青县| 柘城县| 北票市| 来凤县| 中宁县| 鄂伦春自治旗| 鹿泉市|