Last active
May 28, 2017 09:45
-
-
Save hanjae-jea/c2eff933a75796f43c0ac7f0173d16cc to your computer and use it in GitHub Desktop.
calloc
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
// to make chart[100][1000] in function | |
void main() | |
{ | |
int **chart = (int**)calloc(100, sizeof(int*)); | |
for (int i = 0; i < 100; i++) { | |
chart[i] = (int*)calloc(1000, sizeof(int)); | |
} | |
for (int i = 0; i < 100; i++) { | |
for (int j = 0; j < 1000; j++) { | |
chart[i][j] = i*j; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment