Skip to content

Instantly share code, notes, and snippets.

@rdegges
Created July 27, 2010 04:03
Show Gist options
  • Save rdegges/491711 to your computer and use it in GitHub Desktop.
Save rdegges/491711 to your computer and use it in GitHub Desktop.
/*
* test.c
*
* This example program demonstrates a weird way to reference array elements in
* C. All credit goes to the Stack Overflow 'Strangest language feature'
* discussion page:
* http://stackoverflow.com/questions/1995113/strangest-language-feature
*/
#include <stdio.h>
int main(int argc, char **argv) {
int arr[10];
arr[0] = 1;
printf("arr[0] = %d\n", arr[0]);
printf("0[arr] = %d\n", 0[arr]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment