トップページ > キーワード検索 > #if
C言語規格
C言語(その他)
プログラム
その他
#if
機能 判断指令を表す。
判断指令とは、真偽の判断結果によって組み込むかどうかを判定することを表す。
#endif#elif#elseのいずれかまでの文を組み込む
※ 翻訳(コンパイル)時に処理される
定義 #if 制御式
実装例
#include <stdio.h>

#if 1
#define A 123  /* 組み込まれる   */
#endif

#if 0
#define A 456  /* 組み込まれない */
#endif

int main(void)
{
    printf("%d\n", A);
    
    return 0;
}
実行結果
123





inserted by FC2 system