当前位置:网站首页>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] << ' ';
}
边栏推荐
- JS input and output
- Leetcode minimum difference in student scores
- 3. Type of fund
- If you‘re running pod install manually, make sure flutter pub get is executed first.
- Why is the salary of test and development so high?
- Clickhouse (03) how to install and deploy Clickhouse
- A line of R code draws the population pyramid
- 5G VoNR+之IMS Data Channel概念
- Leetcode longest public prefix
- DFS,BFS以及图的遍历搜索
猜你喜欢

Weebly移动端网站编辑器 手机浏览新时代

offer如何选择该考虑哪些因素

【愚公系列】2022年7月 Go教学课程 005-变量

Techniques d'utilisation de sublime

qt 简单布局 盒子模型 加弹簧

AttributeError: module ‘torch._C‘ has no attribute ‘_cuda_setDevice‘

Inventory host list in ansible (I wish you countless flowers and romance)

C语言中函数指针与指针函数

c语言神经网络基本代码大全及其含义

No experts! Growth secrets for junior and intermediate programmers and "quasi programmers" who are still practicing in Universities
随机推荐
腾讯云数据库公有云市场稳居TOP 2!
如何设计 API 接口,实现统一格式返回?
U++ 元数据说明符 学习笔记
【二叉树】二叉树寻路
JS variable
Ansible概述和模块解释(你刚走过了今天,而扑面而来的却是昨天)
App embedded H5 --- iPhone soft keyboard blocks input text
与利润无关的背包问题(深度优先搜索)
【最佳网页宽度及其实现】「建议收藏」
U++4 接口 学习笔记
Timer创建定时器
PLC Analog output analog output FB analog2nda (Mitsubishi FX3U)
ClickHouse(03)ClickHouse怎么安装和部署
当 Knative 遇见 WebAssembly
JS 的 try catch finally 中 return 的执行顺序
Comparison between thread and runnable in creating threads
vector和类拷贝构造函数
Clickhouse (03) how to install and deploy Clickhouse
【736. Lisp 语法解析】
PLC模拟量输出 模拟量输出FB analog2NDA(三菱FX3U)