C array indexing

Table of Contents

instead of x[2], you can use 2[x] to get the exact same piece of memory.

int main(int argc, char *argv[]) {
    int *x = malloc(sizeof(int) * 3);
    2[x] = 3;
    printf("%d",2[x]);
    return 0;
}

There’s no reason you should do that, but it is just very fun

1. reference

Daniel Diaz told me this works, but I can’t find it on the internet

Author: Linfeng He

Created: 2024-04-03 Wed 20:17