编程之美学习过程积累
来源:互联网 发布:2017达内网络视频课程 编辑:程序博客网 时间:2024/06/05 23:57
一、动态数组的定义
1、要定义固定长度的数组
方法一、int array[10].
方法二、const int n=10
int array[n]
而不能
int n;
cin>>n;
int array[n];
也就是说直接给定义的array[n]一个变量作为长度是不行的。必须用一个常量初始化的const变量。
2、延长数组长度
一维数组:const int len=10;
int *p=new int[len];
二维数组 :const int row1=10;
const int column=10;
int **p=new int*[row1];
for(int i=0;i<row1;i++)
p = new int[column];
int *p=new int[len];
二维数组 :const int row1=10;
const int column=10;
int **p=new int*[row1];
for(int i=0;i<row1;i++)
p = new int[column];
0 0
- 编程之美学习过程积累
- 《编程之美》学习笔记
- 编程之美 学习笔记
- 《编程之美》学习笔记
- 编程之美学习笔记之2.1
- 编程之美2.2学习笔记
- 《编程之美》烙饼排序算法学习
- 编程之美 学习笔记1_1
- <编程之美>学习笔记1
- 《编程之美》学习笔记之 最大公约数问题
- 编程之美第一章游戏之乐学习总结
- 编程之美学习之快速找出故障机器
- 推荐《编程之美》
- 编程之美 - 序
- 品味《编程之美》
- 编程之美???
- 编程之美
- 编程之美
- POJ-2718-Smallest Difference
- ASP.NET中XML转JSON的方法
- java 字符串null与isEmpty()
- C语言条件编译
- 创建对话框
- 编程之美学习过程积累
- navicat8_mysql_cs 注册码
- UVA 1366 - Martian Mining(dp)
- apache安装
- C#封装的海康DVR客户端SDK
- IOS 发送短信实现
- OCP-1Z0-053-V13.02-402题
- C#封装的海康DVR客户端SDK
- 单点登录 SSO