ifdef 語句使用方法

2021-10-02 11:10:59 字數 930 閱讀 8537

#ifdef expression 

//《標識》

execution1 //待執行語句1

#elif

//else 語句可以省略

execution2 //待執行語句2

#else

execution3 //待執行語句3

#endif

#ifndef expression 

//《標識》

expression4

#endif

下面舉幾個例子

例:

#include

intmain

(int argc,

char

*ar**)

執行結果為:

press any key to continue

因為flag未巨集定義,「hello world"不會被列印出來,若加上巨集定義,如:

#include

#define flag 1

intmain

(int argc,

char

*ar**)

此時,執行結果為:

hello world

press any key to continue

#include

intmain()

#ifndef debug

#include

"program.c"

#include

#endif

動態語句的使用方法

雖然是 但經過鄙人親自操作,而後有感 生成測試表ta if not object id ta is null drop table ta go create table ta id int primary key,col1 int,col2 nvarchar 10 insert ta select ...

js的with語句使用方法

1 簡要說明 with 語句可以方便地用來引用某個特定物件中已有的屬性,但是不能用來給物件新增屬性。要給物件建立新的屬性,必須明確地引用該物件。2 語法格式 with object instance 有時候,我在乙個程式 中,多次需要使用某物件的屬性或方法,照以前的寫法,都是通過 物件.屬性或者物件...

基本SQL語句使用方法

結構 增 create database 庫名 charset 字符集 create table 表名稱 欄位名 型別 約束 欄位名 型別 約束 not null 非空 primary key 主鍵 唯一且非空 unque 唯一約束 唯一可為空 foreign key 外來鍵約束 可為空,非空值與主...