定义:同一种类型数据的集合

通俗的讲就是,将多个同一种类型的数据按一定的内存顺序写在一起。

注意我的几个关键字“多个”,“同一种”,“一定的内存顺序”。如果理解了这几个关键词,说明你的数组已经掌握了。

我们分开了解这几个关键词:

多个:首先数组是为了存储多个数据而产生的,如果你只有一个数据那就没必要用数组了,当然你非要定义数组存储单个数据也是不会报错的。

//eg
#include<iostream>
using namespace std;

void main()
{
int a; //等效于 int a[1];
int num[10]; //一般用于定于多个,此处就表示,定义10个int类型的数据
     //注意数组是从零开始计数的
}

同一种:数组最重要的特点就是将相同类型的数据放在了一起,便于以后的各种迭代处理,直接看代码更容易理解

//eg
#include<iostream>
using namespace std;

void main()
{
   int a[10]; //假如你现在需要十个正整型数据 先赋值再求和
   int sun = 0; //定义sum的初始值为0
   for(int i = 0; i < 10; ++i)
  {
       a[i] = i;
  }
   for(int j = 0; j < 10; ++j)
  {
       sum += a[j];
  }
cout << sum << endl;
}

一定的内存顺序:这块是很重要的,即数组在内存中的相邻数据之间的间隔一定的(数据类型的长度),数组和指针可以相互使用,现在很好的理解数组的内存结构,在后面指针那里就很容易学懂了。

#include<iostream>
using namespace std;
void main()
{
int a[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; //我们可以先去打印a[0] 与 a[9]之间的内存差看看效果
cout << &a[0] <<" "<< &a[9]  << endl; //& 在这里是取地址符
cin.get();
}

用两个地址作差除去,size(int),看看是个什么结果。下面我将用图来解释:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABFsAAACpCAYAAAD0tTIJAAAgAElEQVR4nO3dO1bjSrcA4OJfdyi4AxYjgBFAJ0SkZCaEhIyws04ghIyUiKRhBDACFsExc+Gq9LAlWfILGWz8fev6vxzaNrJcKlXt2lW19ZEIAAAAAHTif999AAAAAAA/iWALAAAAQIcEWwAAAAA6JNgCAAAA0CHBFgAAAIAOCbYAAAAAdEiwBQAAAKBDgi0AAAAAHRJsAQAAAOiQYAsAAABAhwRbAAAAADok2AIAAADQIcE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ADQIcEWAAAAgA4JtgAAAAB0SLAFAAAAoEOCLQAAAAAdEmwBAAAA6JBgCwAAAECHBFsAAAAAOvT/Z71xvMKug+IAAAAASUVORK5CYII=" alt="" />

数组的初始化

数组的初始化有很多的种方法,这里我将写出最长见的几种:

#include<iostream>
using namespace std;
int main()
{
int a[10] = {0}; //这种方式将默认是个元素全部为零
   int b[10] = {0,1,2,3,4,5,6,7,8,9};//一一对应的方式。
   //也可以在后续的过程中给出自己的操作
   return 0;
}

这里还有二维数组未说明,后期继续,写得有问题的地方请指出,我改正,谢谢!

c/c++一维数组简单介绍的更多相关文章

  1. JavaScript数组的简单介绍

    ㈠对象分类 ⑴内建对象 ⑵宿主对象 ⑶自定义对象   ㈡数组(Array) ⑴简单介绍 ①数组也是一个对象 ②它和我们普通对象功能类似,也是用来存储一些值的 ③不同的是普通对象是使用字符串作为属性名的 ...

  2. html标签内部简单加js 一维数组求最大值 最小值两个值位置和数字金字塔图形

     html标签内部,简单加js <a href=""></a><!DOCTYPE html PUBLIC "-//W3C//DTD XHTM ...

  3. 利用Python进行数据分析(7) pandas基础: Series和DataFrame的简单介绍

    一.pandas 是什么 pandas 是基于 NumPy 的一个 Python 数据分析包,主要目的是为了数据分析.它提供了大量高级的数据结构和对数据处理的方法. pandas 有两个主要的数据结构 ...

  4. python numpy 模块简单介绍

    用python自带的list去处理数组效率很低, numpy就诞生了, 它提供了ndarry对象,N-dimensional object, 是存储单一数据类型的多维数组,即所有的元素都是同一种类型. ...

  5. 【浅墨著作】《OpenCV3编程入门》内容简单介绍&amp;勘误&amp;配套源码下载

    经过近一年的沉淀和总结,<OpenCV3编程入门>一书最终和大家见面了. 近期有为数不少的小伙伴们发邮件给浅墨建议最好在博客里面贴出这本书的文件夹,方便大家更好的了解这本书的内容.事实上近 ...

  6. 二维数组转化为一维数组 contact 与apply 的结合

    将多维数组(尤其是二维数组)转化为一维数组是业务开发中的常用逻辑,除了使用朴素的循环转换以外,我们还可以利用Javascript的语言特性实现更为简洁优雅的转换.本文将从朴素的循环转换开始,逐一介绍三 ...

  7. python之pandas简单介绍及使用(一)

    python之pandas简单介绍及使用(一) 一. Pandas简介1.Python Data Analysis Library 或 pandas 是基于NumPy 的一种工具,该工具是为了解决数据 ...

  8. Smali语法简单介绍

    Smali语言其实就是Davlik的寄存器语言: Smali语言就是android的应用程序.apk通过apktool反编译出来的都有一个smali文件夹,里面都是以.smali结尾的文件,文件的展示 ...

  9. professional cuda c programming--CUDA库简单介绍

    CUDA Libraries简单介绍   上图是CUDA 库的位置.本文简要介绍cuSPARSE.cuBLAS.cuFFT和cuRAND.之后会介绍OpenACC. cuSPARSE线性代数库,主要针 ...

随机推荐

  1. udev磁盘绑定

    udev磁盘绑定 [grid@db-rac02 ~]$ cat 99-asm-multipath.rules KERNEL=="sd*",SUBSYSTEM=="bloc ...

  2. php预定义常量

    <?php echo "当前文件路径: ".__FILE__; echo "<br/>当前行数:".__LINE__; echo " ...

  3. 怎么精确控制solidworks里面的表格的位置

    手工移动是不可能的,总是有点误差,虽然有主动捕捉的功能. public void SetTablePosition(TableAnnotation table, double x, double y) ...

  4. UnityShaderVariant的一些探究心得

    最近遇到了一个问题,角色在Unity编辑器里运行渲染结果都是好的,打包到IOS上却发现,角色身上渲染的很黑.花了些时间查了查,又试了试,把这方面算是初步弄清楚了. 先说出现问题的原因,由于我们把sha ...

  5. 我的第一个flutter程序

    环境搭建好了之后,终于可以开始flutter的学习,废话少说先开始‘Hello World’. 创建好flutter项目之后,打开设备模拟器 打开之后 准备ok,开始编码 -------------- ...

  6. 根据URL地址获取对应的HTML,根据对应的URL下载图片

    核心代码(获取HTML): #region 根据URL地址获取信息GET public static String GetResult(string url) { return GetResult(u ...

  7. <iframe width="250" height="250" src="http://www.baidu.com"></iframe>

     <iframe width="250" height="250" src="http://www.baidu.com">< ...

  8. uva-507

    题意:连续序列和最大,直接枚举..... 代码跑了2.4s.QAQ #include <string> #include<iostream> #include<map&g ...

  9. Powerdesigner16 逆向 postgresql9.2

    参考配置连接:https://www.cnblogs.com/simpleZone/p/5489781.html 过程中遇到的问题: 1.Powerdesigner需要用32位的jdk进行逆向,所以需 ...

  10. PostgreSQL模式(schema)介绍

    一个PostgreSQL数据库集群包含一个或多个已命名数据库.用户和用户组在整个集群范围内是共享的,但是其它数据并不共享.任何与服务器连接的客户都只能访问那个在连接请求里声明的数据库. 注意: 集群中 ...