Skip to content

Instantly share code, notes, and snippets.

@Alberdi
Last active December 11, 2015 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alberdi/4635669 to your computer and use it in GitHub Desktop.
Save Alberdi/4635669 to your computer and use it in GitHub Desktop.
2D array usage example in C.
#define N 500
#define M N/2
#include <stdio.h>
int main(int argc, char **argv) {
int C[N][N];
if((&C[M][N+100] == &C[M+1][100]) && (&C[M][N+100] == &(*C)[M*N+N+100])) {
printf("&C[M][N+100] == &C[M+1][100] == &(*C)[M*N+N+100]\n");
printf("%p == %p == %p\n", &C[M][N+100], &C[M+1][100], &(*C)[M*N+N+100]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment