Created
November 5, 2017 18:25
-
-
Save sorindragan/d6c866eb8434986b78eb444873d48cc0 to your computer and use it in GitHub Desktop.
3D matrix in C with memory allocation
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
int main() { | |
grid = (int***)malloc(num_players * sizeof(int**)); | |
for (int i = 0; i < num_players; i++) { | |
grid[i] = (int**)calloc(num_lines, sizeof(int*)); | |
for (int j = 0; j < num_lines; j++) { | |
grid[i][j] = (int*)calloc(num_cols, sizeof(int)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment