当前位置:网站首页>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] << ' ';
}
边栏推荐
- qt 简单布局 盒子模型 加弹簧
- 高数中值定理总结
- STM32F103 realize IAP online upgrade application
- Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
- DBSync新增对MongoDB、ES的支持
- Function pointer and pointer function in C language
- JS variable plus
- Salesforce 容器化 ISV 场景下的软件供应链安全落地实践
- C语言中函数指针与指针函数
- 使用Thread类和Runnable接口实现多线程的区别
猜你喜欢
随机推荐
《四》表单
sublime使用技巧
U++4 interface learning notes
Analysis -- MySQL statement execution process & MySQL architecture
Batch normalization (Standardization) processing
AttributeError: module ‘torch._ C‘ has no attribute ‘_ cuda_ setDevice‘
2.证券投资基金的概述
01机器学习相关规定
Decorator basic learning 02
全链路压测:影子库与影子表之争
SQL injection - secondary injection and multi statement injection
全国气象数据/降雨量分布数据/太阳辐射数据/NPP净初级生产力数据/植被覆盖度数据
If you ask me about R code debugging, I will tell you head, STR, help
Factor analysis r practice (with R installation tutorial and code)
STM32F103ZE+SHT30检测环境温度与湿度(IIC模拟时序)
史上最全学习率调整策略lr_scheduler
装饰器基础学习02
offer如何选择该考虑哪些因素
JS 的 try catch finally 中 return 的执行顺序
Inventory host list in ansible (I wish you countless flowers and romance)









