⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 14.cpp

📁 C++编的关于智能初始化数组的小程序
💻 CPP
字号:
// 14.cpp : Defines the entry point for the console application.
// 演示数组的初始化

#include "stdafx.h"
#include <iostream>

using namespace std;
enum {array_size = 6};

void watch(const int *x)
{ // 遍历全部的数组元素
	for (int i = 0; i < array_size; i++)
		cout << " x[" << i << "] = " << x[i] ;
	cout << endl;
	
}
void main() 
{
	int a[array_size] = {0};
	int b[array_size] = {1};
	int c[array_size] = {1,2,3};
	int d[array_size]; 
	//编译器可能将告警:数组未初始化
	watch(a);
	watch(b);
	watch(c);
	watch(d);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -