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

C语言打印不带分号

C语言在不使用分号的情况下打印"hello"

我们可以在不使用分号的情况下在C中打印"hello"或" hello world"或其他任何内容。有多种方法可以做到这一点:
使用if 使用switch 使用循环等。

程序1: 使用if语句

让我们看一个简单的c示例,使用if语句而不使用分号来打印" hello world"。
#include<stdio.h>
 int main()  
{  
 if(printf("hello world")){}  
return 0;
} 
输出:
hello world

程序2: 使用switch语句

我们来看一个简单的c示例,该示例使用switch语句而不使用分号打印" hello world"。
#include<stdio.h>
 int main()  
{  
switch(printf("hello world")){}  
return 0;
} 
输出:
hello world

程序3: 使用while循环

让我们看一个简单的c示例,使用while循环而不使用分号来打印" hello world"。
#include<stdio.h>
 int main()  
{  
   while(!printf("hello world")){}  
return 0;
} 
输出:
hello world

昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4