int i; int **Array; Array= (int **)malloc(m*sizeof(void *)); for (i=0; i<m; i++) Array[i]=(int *)malloc(n*sizeof(int *));
參考:
1. 釋放及產生動態陣列應該注意的事情
http://squall.cs.ntou.edu.tw/cprog/materials/DynamicMemoryAllocation.html
2. 產生動態多維陣列
http://lagunawang.pixnet.net/blog/post/7741220-%5B%E8%BD%89%E9%8C%84%5Dc-c%2B%2B-%E7%9A%84%E5%A4%9A%E7%B6%AD%E5%8B%95%E6%85%8B%E9%99%A3%E5%88%97
沒有留言:
張貼留言