二维函数作为参数

二维函数作为参数

#include <iostream>
using namespace std;

void func(int* arr, int n, int m)
{
    cout << arr[n*m-1] << endl;
    cout << "test success" << endl;
}

int main()
{
    int arr[2][2] = { 1, 2, 3, 4 };
    dfs(arr[0], 2, 2);
    printf("hello world.\n");
    system("pause");
    return 0;
}

如果写成

void func(int arr[][10], int n)
{
    cout << "确定第二维的话又怎么能有通用性呢" << endl;
}

 

posted @ 2016-09-29 17:11  YORU  阅读(200)  评论(0编辑  收藏  举报