进来帮下忙!

lisenlin5 2012-10-10 05:07:51
#include<stdio.h>
void fun(int rows ,int cols ,double source[rows][cols],double target[rows][cols]);
void fun2(int rows,int cols,double ar[rows][cols]);
int main(void)
{
int rs=3;
int cs=5;
double array[rs][cs]={
{32.3,43.12,34.5,3.2,6.2},
{5.2,12.5,3.12,53.1,5.3},
{32.5,54.2,52.1,6.12,6.2}
};
double array1[rs][cs];
fun(rs,cs,array,array1);
fun2(rs,cs,array);
fun2(rs,cs,array1);
return 0;
}

void fun(int rows,int cols,double source[rows][cols],double target[rows][cols])
{
int i,j;
for(i=0;i<rows;i++)
{
for(j=0;j<cols;j++)
{
target[i][j]=source[i][j];
}
}
}

void fun2(int rows,int cols,double ar[rows][cols])
{
int i,j;
for(i=0;i<rows;i++)
{
for(j=0;j<cols;j++)
printf("%5.2f",ar[i][j]);
printf("\n");
}
}

这是我写的基于变长数组的函数的程序,但我不管怎么改编译都会有报错!编程数组是C99标准下的!我用的VC++6.0支持C99不,如果支持的话,那我的程序到底什么地方有大的错误才导致了很多的错误报出来了!如果VC++6.0不支持C99,那么你们可以给我推荐支持C99标准的编译器不?
真的谢谢大家了!
...全文
51 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2012-10-10
  • 打赏
  • 举报
回复
偶遇到类似问题都是用
“每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。”
的方法解决的。
大熊猫侯佩 2012-10-10
  • 打赏
  • 举报
回复
如上...
longburulin 2012-10-10
  • 打赏
  • 举报
回复
int rs=3;
int cs=5;
加上const int rs=3;
const int cs=5;
tbg1986tbg 2012-10-10
  • 打赏
  • 举报
回复
数组不支持变量。
十八道胡同 2012-10-10
  • 打赏
  • 举报
回复
支持的很差。。

可以用gcc....

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧