当前位置:网站首页>[c语言]二维数组动态分配内存
[c语言]二维数组动态分配内存
2022-07-30 19:53:00 【r77683962】
#include <stdio.h>
#include <stdlib.h>
int main()
{
int **p = 0;
p = (int **)malloc(10 * sizeof(int *));
if (NULL == p)
{
printf("malloc error");
return 0;
}
for(int i=0;i<10;i++)
{
p[i] = (int *)malloc(10 * sizeof(int *));
if (NULL == p[i])
{
printf("malloc2 error");
return 0;
}
}
for(int i=0;i< 10;i++)
{
for(int j=0;j< 10;j++)
{
p[i][j] = i * 10 + j;
printf("%d ", p[i][j]);
}
printf("\n");
}
}
边栏推荐
- 使用MULTISET来比较数据集的实例介绍
- MySQL分库分表
- MindSpore:npu 多卡训练自定义数据集如何给不同npu传递不同数据
- MySQL性能优化(硬件,系统配置,表结构,SQL语句)
- mysql慢查询优化
- MindSpore:Cifar10Dataset‘s num_workers=8, this value is not within the required range of [1, cpu_thr
- Linux下最新版MySQL 8.0的下载与安装(详细步骤)
- Is the iPhone really thirteen incense?The two generations of products are completely compared, perhaps the previous generation is more worth buying
- centos7安装mysql8
- Centos7 install mysql8
猜你喜欢
Snowflake vs. Redshift的2022战报:两个数据平台谁更适合你?
PHP低代码开发平台 V5.0.7新版发布
MySQL数据库之JDBC编程
LeetCode 0952. Calculate Maximum Component Size by Common Factor: Mapping / Union Search
Is the iPhone really thirteen incense?The two generations of products are completely compared, perhaps the previous generation is more worth buying
MindSpore:【Resolve node failed】解析节点失败的问题
MySQL数据库主从配置
MindSpore:【JupyterLab】查看数据时报错
Install MySQL tutorial under Linux
What is the difference between a cloud database and an on-premises database?
随机推荐
Download and installation of the latest version of MySQL 8.0 under Linux (detailed steps)
win2003下FTP服务器如何搭建
技术很牛逼,还需要“向上管理”吗?
PostgreSQL 14.4如何安装使用
What is the difference between a cloud database and an on-premises database?
Day31 LeetCode
MySQL eight-part text recitation version
Cesium loads offline maps and offline terrain
青蛙跳台阶(递归和非递归)-------小乐乐走台阶
用jOOQ 3.17投射类型安全的嵌套表记录
阿里面试官:给我描述一下缓存击穿的现象,并说说你的解决思路?
MySQL six-pulse sword, SQL customs clearance summary
Linux download and install mysql5.7 version tutorial the most complete and detailed explanation
MySQL database --- Addition, deletion, modification and query of MySQL tables (advanced)
M3SDA:用于多源域自适应的矩匹配
时间复杂度与空间复杂度
[hbuilder] cannot run some projects, open the terminal and cannot enter commands
How architects grow
推荐系统:实时性【特征实时性:客户端实时特征(秒级,实时)、流处理平台(分钟级,近实时)、分布式批处理平台(小时/天级,非实时)】【模型实时性:在线学习、增量更新、全量更新】
移动web开发01