Skip to content

Instantly share code, notes, and snippets.

@hanjae-jea
Last active May 28, 2017 09:45
Show Gist options
  • Save hanjae-jea/c2eff933a75796f43c0ac7f0173d16cc to your computer and use it in GitHub Desktop.
Save hanjae-jea/c2eff933a75796f43c0ac7f0173d16cc to your computer and use it in GitHub Desktop.
calloc
#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