zoukankan      html  css  js  c++  java
  • 编写一个通用的二维数组输出函数

    以下是基于二维数组本身就是连续的思想编写的

    View Code
     1 #include<iostream>
     2 using namespace std;
     3 void printfA(int *p,int row,int col){//二维数组的第一个小元素地址,a[0][0]的地址,行,列 
     4     int i;
     5     for(i=0;i<row*col;i++,p++){
     6         if(i%col==0)
     7           cout<<endl;
     8         cout<<"    "<<*p;
     9     }
    10     cout<<endl;
    11 }
    12 int main(){
    13     int a[4][3]={{1,3,4},{4,43,2},{42,43,12},{14,43,22}};
    14     printfA(a[0],4,3);
    15     return 0;
    16     
    17 }
  • 相关阅读:
    装饰复杂函数
    装饰器01
    闭包
    函数的嵌套定义
    名称空间
    函数的嵌套调用
    函数的对象
    形参
    实参
    形参与实参
  • 原文地址:https://www.cnblogs.com/aijianiula/p/2916365.html
Copyright © 2011-2022 走看看