MDGSF Software Engineer

[C/C++] C语言中的奇葩语法1

2016-09-30

#include <stdio.h>

int main()
{
    printf("%c\n", "abcdef"[5]);
    printf("%c\n", 5["abcdef"]);

    char a[] = "abcdef";
    char * p = a;
    printf("%c\n", 5[a]);
    printf("%c\n", a[5]);
    printf("%c\n", 5[p]);
    printf("%c\n", p[5]);
    printf("%c\n", *(p+5));
    printf("%c\n", *(5+p));
    return 0;
}

weixingongzhonghao

Similar Posts

Comments