alloc 2d array, memset and malloc
#include <iostream>
#include <stdlib.h>
#include <cstring>
using namespace std;
// alloc 2d array
int main() {
int *a = (int*)malloc(sizeof(int)*16);
memset(a, 0, sizeof(int)*16);
// case 2
int a[4][4];
memset(a, 0, sizeof(int)*16;
// case 3, alloc mem for char a[10][20]
char **a;
a = (char**)malloc(10*sizeof(char*));
for(int i=0; i<10; i++)
a[i] = (char*)malloc(sizeof(char)*20);
}