二维函数作为参数

二维函数作为参数

#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.
");
    system("pause");
    return 0;
}

如果写成

void func(int arr[][10], int n)
{
    cout << "确定第二维的话又怎么能有通用性呢" << endl;
}
原文地址:https://www.cnblogs.com/yoru/p/5920575.html