로딩
티스토리 데이터 처리 중입니다.

[C언어] 조건부 컴파일 #ifdef #endif #if #ifndef

 [C언어] 조건부 컴파일 #ifdef #endif #if #ifndef

#ifdef에 매크로를 지정하면 해당 매크로가 정의되어 있을 때만 코드를 컴파일합니다. #ifdef 매크로 코드 #endif example) #include #define DEBUG // DEBUG 매크로 정의 int main() { #ifdef DEBUG // DEBUG 매크로가 정의되어 있다면 #ifdef, #endif 사이의 코드를 컴파일 printf("Debug: %s %s %s %d\n", __DATE__, __TIME__, __FILE__, __LINE__); #endif return 0; } >> 결과 : Debug: Oct 6 2015 23:30:18 c:\project\hello\conditional_compile\conditional_compile.c 8 #if로 값 또는 식을 판별하여.....