当前位置:网站首页>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] << ' ';
}
边栏推荐
- Using thread class and runnable interface to realize the difference between multithreading
- Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)
- 5G VoNR+之IMS Data Channel概念
- JS input and output
- 最长不下降子序列(LIS)(动态规划)
- Why is the salary of test and development so high?
- U++4 interface learning notes
- Timer创建定时器
- IMS data channel concept of 5g vonr+
- Weebly移动端网站编辑器 手机浏览新时代
猜你喜欢
随机推荐
Test interview | how much can you answer the real test interview question of an Internet company?
The sooner you understand the four rules of life, the more blessed you will be
Sublime tips
C语言中函数指针与指针函数
PLC模拟量输出 模拟量输出FB analog2NDA(三菱FX3U)
Batch normalization (Standardization) processing
最长公共子序列(LCS)(动态规划,递归)
ScheduledExecutorService定时器
LabVIEW在打开一个新的引用,提示内存已满
JS variable plus
最全常用高数公式
Development thoughts of adding new requirements in secondary development
使用Thread类和Runnable接口实现多线程的区别
AOSP ~Binder 通信原理 (一) - 概要
【PHP SPL笔记】
CentOS 7.9安装Oracle 21c历险记
最长回文子串(动态规划)
pmp真的有用吗?
想要选择一些部门优先使用 OKR, 应该如何选择试点部门?
Leetcode longest public prefix









