Last active
December 11, 2015 17:38
-
-
Save Alberdi/4635669 to your computer and use it in GitHub Desktop.
2D array usage example in C.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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