btw

I discovered my new favourite fact about my new favourite language recently. I suppose it should be obvious but I hadn't though about it in explicitly these terms.

Given:

char* myStringArray[] = {"Hello", "Goodbye", "Tomatoes"};
int index = 2;

then the following will print Tomatoes:

printf("%s\n", myStringArray[index]);

and so (this is the bit I hadn't fully realised) will this:

printf("%s\n", index[myStringArray]);

Good times :)