c - 这怎么可能?

标签 c

<分区>

在下面的代码中,甚至在 main 函数的 block 开始之前都有声明。这是允许的吗?

long long n,u,m,b;
main(e,r)
    char **r; //<<<Is this possible???
{
    for( ; n++ || (e=getchar()|32)>=0 ; b="ynwtsflrabg"[n%=11]-e?b:b*8+n)
        for( r=b%64-25 ; e<47&&b ; b/=8)
            for( n=19; n ; n["1+DIY/.K430x9G(kC["]-42&255^b||(m+=n>15?n:n>9?m%u*~-u:~(int)r?n+!(int)r*16:n*16,b=0))
            u=1ll<<6177%n--*4;printf("%llx\n",m);
}

来源:我在 ioccc.org 上找到了这段代码

最佳答案

是的,C 语言允许在函数外声明。这些声明定义了全局变量或静态变量(为此你需要一个 static 修饰符)。

重新格式化你的程序会产生这个:

long long n,u,m,b;
main(e,r)
    char **r; // Pre-ANSI parameter declarations; do not do that in new programs!
{
    for( ; n++ || (e=getchar()|32)>=0 ; b="ynwtsflrabg"[n%=11]-e?b:b*8+n)
        for( r=b%64-25 ; e<47&&b ; b/=8)
            for( n=19; n ; n["1+DIY/.K430x9G(kC["]-42&255^b||(m+=n>15?n:n>9?m%u*~-u:~(int)r?n+!(int)r*16:n*16,b=0))
                u=1ll<<6177%n--*4;printf("%llx\n",m);
}

这里发生了一些严重的混淆,但从语法上讲它是有效代码。

关于c - 这怎么可能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18421135/

相关文章:

c - 如何解决 "subscripted value is neither array nor pointer nor vector"

c - 循环通过位 C

c - 陷入位图的实现中

java - 如何在jna中获取指向结构体数组的指针

c - 如何在C中将整数转换为字符串?

c - 锁定 api 的正确约定是什么?

c - "complex float"和 "float complex"都是有效的 C 吗?

c - 分离链表中的奇数和偶数,段错误

c - 并行数组或结构体数组

C# - 如何在没有 IDE/Visual Studio 的情况下制作程序?