Skip to content

Instantly share code, notes, and snippets.

@dimlucas
Last active July 11, 2017 13:57
Show Gist options
  • Save dimlucas/611dafb6f7c8ac3a75c51eb8a201b1a6 to your computer and use it in GitHub Desktop.
Save dimlucas/611dafb6f7c8ac3a75c51eb8a201b1a6 to your computer and use it in GitHub Desktop.
int** matrix = malloc(10*sizeof(int*));
if(matrix == NULL)
{
fprintf(stderr, "Memory Allocation Failed\n");
exit(EXIT_FAILURE);
}
int i;
for(i=0; i<10; i++)
{
matrix[i] = malloc(5*sizeof(int));
if(matrix[i] == NULL)
{
fprintf(stderr, "Memory Allocation Failed\n");
exit(EXIT_FAILURE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment