c编程打印hello world消息 [英] c programming printing the hello world message

查看:137
本文介绍了c编程打印hello world消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可以用c语言打印hello world消息。没有在程序中使用任何分号。

如果是那么如何?

解决方案

是。





通过使用神奇的预处理器;这使C变得如此强大和危险。



 C:\ JBUTIL>类型nosemi.c 
int main( ){printf(Hello world)SEMI}

C:\ JBUTIL> gcc -include stdio.h -oNoSemi.exe -DSEMI =; NoSemi.c

C:\ JBUTIL> nosemi
Hello world
C:\ JBUTIL>







可能,但不推荐。





或者你可以去整个hog ...



 C:\ JBUTIL>类型badc.c 
这个程序会说Hello world然后结束

C:\ JBUUTIL> gcc -include stdio.h -oBadC.exe -DThis = int -Dprogram = main()-Dwill = {-Dsay = printf(-Dand =)-Dthen =; -Dend =} BadC.c

C:\ JBUTIL> BadC.exe
Hello world
C:\ JBUTIL>


is this possible in c language to print the "hello world" message. without using any semicolon in the program.
if it is then how?

解决方案

Yes.


Through the use of the magical pre-processor; that which makes C so powerful and dangerous.

C:\JBUTIL>type nosemi.c
int main() { printf ( "Hello world" ) SEMI }

C:\JBUTIL>gcc -include stdio.h -oNoSemi.exe -DSEMI=;  NoSemi.c

C:\JBUTIL>nosemi
Hello world
C:\JBUTIL>




Possible, but not recommended.


Or you can go whole hog...

C:\JBUTIL>type badc.c
This program will say "Hello world" and then end

C:\JBUTIL> gcc -include stdio.h -oBadC.exe -DThis=int -Dprogram=main() -Dwill={ -Dsay=printf( -Dand=) -Dthen=; -Dend=} BadC.c

C:\JBUTIL>BadC.exe
Hello world
C:\JBUTIL>


这篇关于c编程打印hello world消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆