c - C 中的 hello world 没有分号且没有 IF/WHILE/FOR 语句

标签 c puzzle

<分区>

我的 friend 说可以编写一个 C 程序来打印“hello world”,而无需 IF/WHILE/FOR 和分号。经过最少的研究后,我告诉她这是不可能的。可能吗?

最佳答案

#include <stdio.h>

int main() {
    switch (printf("Hello, world!\n")) {}
}

如果您的 friend 说“哦,您也不能使用 switch”,那么:

#include <stdio.h>

int main(int argc, char *argv[printf("Hello, world!\n")]) {}

关于c - C 中的 hello world 没有分号且没有 IF/WHILE/FOR 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4147836/

相关文章:

c - recv() 直到收到 NUL 字节?

iphone - 如何在 Facebook 或 Twitter 上发布带有本地镜像的格式化文本?

c - 使用 c 重命名和移动目录中的文件

algorithm - 如何仅使用一个额外的整数变量对整数列表进行排序?

android - 如何在不耗尽内存的情况下在 droid 中制作益智应用程序?

c - 如何传递枚举名称直接切换,vc++ mfc

c++ - 如何将 char 数组作为对函数和 memcpy 的引用传递

algorithm - 重组包含模数的公式

java - 使用 Java 将 Image 设置为 Button 并在 Puzzle Game 中处理 ActionListener

c++ - 如何隐藏数独表中的数字?