C++輔導:c++中創(chuàng)建動態(tài)二維數(shù)組

字號:

c++ 中創(chuàng)建動態(tài)二維數(shù)組的程序代碼
    動態(tài)創(chuàng)建一維數(shù)組
    int *arr; //it can be any other type (char, float)
    arr = new int[n]; //n should be integer variable
    動態(tài)創(chuàng)建二維數(shù)組
    int **arr;
    int N,M;
    cin >> N >> M;
    arr = new int*[N];
    for(int i=0;i