C语言教程
C语言控制语句
C语言函数
C语言数组
C语言指针
C语言字符串
C语言数学函数
C语言结构
C语言文件处理
C预处理器

C #else

如果#if的条件为false,则#else预处理程序指令将评估表达式或条件。可以与#if,#elif,#ifdef和#ifndef指令一起使用。
语法:
#if expression
//if code
#else
//else code
#endif
带有#elif的语法:
#if expression
//if code
#elif expression
//elif code
#else
//else code
#endif

C #else示例

让我们看一个使用#else预处理器指令的简单示例。
#include <stdio.h>
#include <conio.h>
#define NUMBER 1
void main() {
#if NUMBER==0
printf("Value of Number is: %d",NUMBER);
#else
print("Value of Number is non-zero");
#endif       
getch();
}
输出:
Value of Number is non-zero
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4