//#include <iostream>
//#include <conio.h>
//using namespace std;
//
//
//void are7(int(&arr)[3][4]); //引用的方式
//void are6(int(*arr)[3][4]); //二维数组指针的方式
//void are5(int *arr, int, int); //一维指针方式
//void are4(int **arr, int, int); //动态分配
//void are3(int(*arr)[4], int); //传入高
//void are2(int arr[][4], int); //传入高
//void are1(int arr[][4]); //高不用填,但一定要一个列
//
//int main()
//{
// //int arr2[3][4] = {
// // { 1, 2, 3 },
// // { 4, 5, 6, 7 },
// // { 8, 9, 10, 11 },
// //};
// //are1(arr2);//二维数组直接传递,退化为指针
// //are2(arr2, 3);
// //are3(arr2,3);
// //int *p = &arr2[0][0];
// //are4(&p, 3, 4);
// //are5((int*)arr2,3,4);
// //are5(arr2[0],3,4);
// //are6(&arr2);
// //are7(arr2);
// system("pause");
// return 0;
//}
//void are1(int arr[][4])
//{
// for (int i = 0; i < 3; i++)
// {
// for (int j = 0; j < 4; j++)
// {
// cout << arr[i][j] << " ";
// }
// cout << endl;
// }
//}
//void are2(int arr[][4], int len)
//{
// for (int i = 0; i < len; i++)
// {
// for (int j = 0; j < 4; j++)
// {
// cout << arr[i][j] << " ";
// }
// cout << endl;
// }
//}
//void are3(int(*arr)[4], int len)
//{
// for (int i = 0; i < len; i++)
// {
// for (int j = 0; j < 4; j++)
// {
// std::cout << arr[i][j] << " ";
// }
// std::cout << std::endl;
// }
//}
//void are4(int **arr, int len, int row)
//{
// arr = new int*[len];
// for (int i = 0; i < len; i++)
// {
// arr[i] = new int[row];
// }
// for (int i = 0; i < len; i++)
// {
// for (int j = 0; j < row; j++)
// {
// std::cout << arr[i][j] << " ";
// }
// std::cout << std::endl;
// }
//}
//void are5(int *arr, int len, int row)
//{
// for (int i = 0; i < len; i++)
// {
// for (int j = 0; j < row; j++)
// {
// std::cout << arr[j + i * row] << " ";
// }
// std::cout << std::endl;
// }
//}
//void are6(int(*arr)[3][4])
//{
// for (int i = 0; i < 3; i++)
// {
// for (int j = 0; j < 4; j++)
// {
// std::cout << (*arr)[i][j] << " ";
// }
// std::cout << std::endl;
// }
//}
//void are7(int(&arr)[3][4])
//{
// for (int i = 0; i < 3; i++)
// {
// for (int j = 0; j < 4; j++)
// {
// std::cout << arr[i][j] << " ";
// }
// std::cout << std::endl;
// }
//}

C++ 数组作为参数的传递的更多相关文章

  1. ref引用类型,数组型参数,out输出参数

    ref和out的相同点和不同点 共同点:都是引用传递不同点:ref的参数在调用之前一定要赋值,在方法调用的过程中可以不要赋值.    out的参数在调用之前可以不赋值,在方法调用的过程中一定要赋值. ...

  2. 你好,C++(26)如何与函数内部进行数据交换?5.1.3 函数参数的传递

    5.1.3  函数参数的传递 我们知道,函数是用来完成某个功能的相对独立的一段代码.函数在完成这个功能的时候,往往需要外部数据的支持,这时就需要在调用这个函数时向它传递所需要的数据它才能完成这个功能获 ...

  3. (转)Java程序利用main函数中args参数实现参数的传递

    Java程序利用main函数中args参数实现参数的传递 1.运行Java程序的同时,可以通过输入参数给main函数中的接收参数数组args[],供程序内部使用!即当你在Java命令行后面带上参数,J ...

  4. [转]数组引用:C++ 数组做参数 深入分析

    "数组引用"以避免"数组降阶"(本文曾贴于VCKBASE\C++论坛) 受[hpho]的一段模板函数的启发,特写此文,如有雷同,实在遗憾. 数组降阶是个讨厌的事 ...

  5. 工作中的趣事:聊聊ref/out和方法参数的传递机制

    0x00 前言 我在之前的游戏公司工作的时候,常常是作为一只埋头实现业务逻辑的码农.在工作之中不常有同事会对关于编程的话题进行交流,而工作之余也没有专门的时间进行技术分享.所以对我而言上家虽然是一家游 ...

  6. C++数组做参数

    首先,看一下下面这段代码: void changearr(int a[],int n){    cout<<sizeof(a)<<endl;         // 输出4}in ...

  7. mybatis中String参数的传递

    mybatis中String参数的传递 Keywords selectKeywords(@Param("key") String key); 可以在mapper方法的参数钱添加 @ ...

  8. Java 一维数组作为参数和返回值

    一维数组作为参数: 传数组的引用 创建数组直接传,本质也是传数组的引用 传null public class Test { //数组作为参数时,可以传递3中形式 public void m1(int[ ...

  9. C#编程(三十四)----------数组作为参数

    原文链接: http://blog.csdn.net/shanyongxu/article/details/46765267 数组作为参数 数组可以作为参数传递给方法,也可以从方法中返回.要返回一个数 ...

随机推荐

  1. dubbo-源码阅读之服务订阅

    配置例子 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://w ...

  2. STL_Algorithm

    #include <algorithm> #include <cstdio> using namespace std; /*虽然最后一个排列没有下一个排列,用next_perm ...

  3. python爬虫环境1

    转载 https://cuiqingcai.com/5052.html 1.1 python3安装  配置环境变量:随后点击“新建”,新建一个条目,将刚才复制的C:\Python36复制进去.这里需要 ...

  4. 转帖 eclipse Web项目WebContent目录修改

    最近在做Web 项目时,新建了一个WEB 项目,如webdemo,eclipse默认的build路径为build,WEB-INF存放于WebContent下面,今改了一个build路径和WebCont ...

  5. PHP ftp_put() 函数

    定义和用法 ftp_put() 函数上传本地一个文件到 FTP 服务器上. 如果成功,该函数返回 TRUE.如果失败,则返回 FALSE. 语法 ftp_put(ftp_connection,remo ...

  6. 画PCB时检查点总结

    一.画原理图时 NPN的引脚是否对应.继电器的引脚是否对应 设计通信电路时,MCU_RX和通信芯片RS232的ROUT接.同理MCU_TX和RS232的TIN接. MCU最好留个外接晶振接口,用NPN ...

  7. NX二次开发-Block UI C++界面Face Collector(面收集器)控件的获取(持续补充 )

    Face Collector(面收集器)控件的获取 NX9+VS2012 #include <uf.h> #include <uf_obj.h> UF_initialize() ...

  8. ES6(简单了解)

    1.import类似于var,不过是定义对外接口的,接受外部的文件. import  xx  from  xx ,有点像var i =3: 如import  profile  from './prof ...

  9. 通用shellcode代码

    #include <stdio.h>#include <windows.h> int main(){ __asm { CLD //清空标志位DF push 0x1E380A6A ...

  10. Android_开发片段(Part 3)

    1.Android中的五种布局方式:线性布局(Linear Layout).相对布局(Relative Layout).表格布局(Table Layout).网格视图(Grid View).标签布局( ...