当前位置:网站首页>Array initialization of local variables
Array initialization of local variables
2022-07-07 05:09:00 【Madness makes freedom】
When the array is not a global variable :
If the array size is a variable , Then the array is initialized to 0 when , The value of the element may not be 0;
If the array size is constant , Then the array is initialized to 0 when , The value of the element is 0;
/**
When the array is not a global variable :
If the array size is a variable , Then the array is initialized to 0 when , The value of the element may not be 0;
If the array size is constant , Then the array is initialized to 0 when , The value of the element is 0;
*/
#include <iostream>
using namespace std;
const int maxn=10;
int main()
{
cout << " Array size is a variable :\n";
cout << " Enter two values :\n";
int n, m;
cin >> n >> m;
int temp[n][m]={0};
for(int i=0;i<n;++i)
for(int j=0;j<m;++j)
cout << temp[i][j] << ' ';
cout << "\n The array size is const Constant of type :\n";
int matr[maxn][maxn]={0};
for(int i=0;i<maxn;++i)
for(int j=0;j<maxn;++j)
cout << matr[i][j] << ' ';
cout << "\n The array size is common Constant :\n";
int a[10][10]={0};
for(int i=0;i<10;++i)
for(int j=0;j<10;++j)
cout << a[i][j] << ' ';
}
边栏推荐
- 精彩速递|腾讯云数据库6月刊
- 最长公共子序列(LCS)(动态规划,递归)
- App embedded H5 --- iPhone soft keyboard blocks input text
- [736. LISP syntax parsing]
- vector和类拷贝构造函数
- Clickhouse (03) how to install and deploy Clickhouse
- 全国气象数据/降雨量分布数据/太阳辐射数据/NPP净初级生产力数据/植被覆盖度数据
- Redis如何实现多可用区?
- Timer创建定时器
- Liste des hôtes d'inventaire dans ansible (je vous souhaite des fleurs et de la romance sans fin)
猜你喜欢
A line of R code draws the population pyramid
[Yugong series] go teaching course 005 variables in July 2022
【opencv】图像形态学操作-opencv标记不同连通域的位置
[Android kotlin collaboration] use coroutinecontext to realize the retry logic after a network request fails
一文搞懂常见的网络I/O模型
动态生成表格
拿到PMP认证带来什么改变?
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
指针与数组在函数中输入实现逆序输出
When knative meets webassembly
随机推荐
U++ game learning notes
【ArcGIS教程】专题图制作-人口密度分布图——人口密度分析
[Android kotlin collaboration] use coroutinecontext to realize the retry logic after a network request fails
AttributeError: module ‘torch._ C‘ has no attribute ‘_ cuda_ setDevice‘
史上最全学习率调整策略lr_scheduler
SQL injection - secondary injection and multi statement injection
NiO related knowledge points (I)
如何设计 API 接口,实现统一格式返回?
[ArcGIS tutorial] thematic map production - population density distribution map - population density analysis
Mysql database (basic)
ScheduledExecutorService定时器
JS 的 try catch finally 中 return 的执行顺序
npm ERR! 400 Bad Request - PUT xxx - “devDependencies“ dep “xx“ is not a valid dependency name
np.random.shuffle与np.swapaxis或transpose一起时要慎用
App embedded H5 --- iPhone soft keyboard blocks input text
3.基金的类型
装饰器基础学习02
STM32 system timer flashing LED
高数中值定理总结
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.