一种很诡异的写法---关于C/C++的参数传递问题

在 常用算法程序集(C语言描述)中有如下的传递方式:

View Code
 int gaus(a,b,n)
  int n;
  double a[],b[];
  { }

这里a数组为一维数组

在主程序中可以传递二维数组过来A[][]

View Code
double A[3][3];
gaus(A,b,n)

 

上述问题主要在VC6.0下编译通过 只能是C代码(直接改CPP不行)

现在改为CPP程序

View Code
double A[][];
double C[];
for()
   for()
    {
       C[]=A[][];//强制转换
}
gaus(C,b,n);

接口(头文件)中 定义

View Code
int gaus(double a[],double b[],int n)
{}

即可使用CPP了

posted @ 2013-01-16 17:02  liang_l  阅读(390)  评论(0编辑  收藏  举报