当前位置:网站首页>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] << ' ';
}
边栏推荐
- 高数中值定理总结
- window定时计划任务
- 使用Thread类和Runnable接口实现多线程的区别
- STM32 encapsulates the one key configuration function of esp8266: realize the switching between AP mode and sta mode, and the creation of server and client
- LabVIEW在打开一个新的引用,提示内存已满
- Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
- AttributeError: module ‘torch._ C‘ has no attribute ‘_ cuda_ setDevice‘
- Sublime tips
- Why JSON is used for calls between interfaces, how fastjson is assigned, fastjson 1.2 [email protected] Mapping relatio
- Redis如何实现多可用区?
猜你喜欢
How to design API interface and realize unified format return?
Gavin teacher's perception of transformer live class - rasa project actual combat e-commerce retail customer service intelligent business dialogue robot microservice code analysis and dialogue experim
01机器学习相关规定
Auto.js 获取手机所有app名字
SQL injection HTTP header injection
Ansible概述和模块解释(你刚走过了今天,而扑面而来的却是昨天)
Flask project uses flask socketio exception: typeerror: function() argument 1 must be code, not str
sublime使用技巧
动态生成表格
Techniques d'utilisation de sublime
随机推荐
高数中值定理总结
基于Bevy游戏引擎和FPGA的双人游戏
U++ 元数据说明符 学习笔记
National meteorological data / rainfall distribution data / solar radiation data /npp net primary productivity data / vegetation coverage data
高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍
《五》表格
If you ask me about R code debugging, I will tell you head, STR, help
使用Thread类和Runnable接口实现多线程的区别
使用知云阅读器翻译统计遗传学书籍
JS variable case
Leetcode(46)——全排列
No experts! Growth secrets for junior and intermediate programmers and "quasi programmers" who are still practicing in Universities
STM32F103ZE+SHT30检测环境温度与湿度(IIC模拟时序)
《四》表单
sublime使用技巧
DBSync新增对MongoDB、ES的支持
Salesforce 容器化 ISV 场景下的软件供应链安全落地实践
01机器学习相关规定
当 Knative 遇见 WebAssembly
Appium practice | make the test faster, more stable and more reliable (I): slice test