Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
更简便地为二维数组开辟空间 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


更简便地为二维数组开辟空间:

以m*n大小的数组举例:

第一种方法:

int **a = new int*[m];
for(int i=0; i < m; i++)
a[i] = new int[n];


第二种方法,较简便:

int* a = new int[m*n];

a[i * n + j] 是第 i 行第 j 列元素

指定下标比较麻烦


https://zhidao.baidu.com/question/193079627.html



返回首页


Copyright (C) 2018-2024 huidong