请教下C语言高手,程序老是报错 `a' was not declared in this scope

10.编写…个程序,声明一个3x5的数组并初始化,具体数值可以随意。程序打印出数值,然后数值翻1番,接着再次打印出新值。编写一个函数来显示数组的内容,再编写另一个函数执行... 10.编写…个程序,声明一个3x5的数组并初始化,具体数值可以随意。程序打印出数值,然后数值翻1番,接着再次打印出新值。编写一个函数来显示数组的内容,再编写另一个函数执行翻倍功能。数组名和数组行数作为参数由程序传递给函数。
#include<stdio.h>
#include<stdlib.h>
#define SIZE1 3
#define SIZE2 5
void mul(int a, int b, double arr[a][b]);
void echo(int a,int b,double arr[a][b]);

int main(void)
{
double one[SIZE1][SIZE2] =
{
{1.1,2.2,3.3,4.4,5.5},
{6.6,7.7,8.8,9.9,10.10},
{11.11,12.12,13.13,14.14,15.15}
};
echo(SIZE1, SIZE2, one);
mul(SIZE1, SIZE2, one);
echo(SIZE1, SIZE2, one);
system("pause");
return 0;
}
void mul(int a, int b, double arr[a][b])
{
int i,n;
for(i = 0;i < a;i++)
{
for(n = 0;n < b;n++)
arr[i][n] *= 2;
};
}
void echo(int a, int b, double arr[a][b])
{
int i,n;
for(i = 0;i < a;i++)
{
printf("\n[%d]\n",i);
for(n = 0;n < b;n++)
printf("%7lg",arr[i][n]);
};
}
编译器用的是dev c++,望高手指点
5: error: `a' was not declared in this scope
5: error: `b' was not declared in this scope
6: error: `a' was not declared in this scope
6: error: `b' was not declared in this scope
In function `int main()':
6: error: too many arguments to function `void echo(int, int)'
16: error: at this point in file
5: error: too many arguments to function `void mul(int, int)'
17: error: at this point in file
6: error: too many arguments to function `void echo(int, int)'
18: error: at this point in file
At global scope:
22: error: `a' was not declared in this scope
22: error: `b' was not declared in this scope
In function `void mul(int, int)':
28: error: `arr' undeclared (first use this function)
28: error: (Each undeclared identifier is reported only once for each function it appears in.)
At global scope:
31: error: `a' was not declared in this scope
31: error: `b' was not declared in this scope
In function `void echo(int, int)':
38: error: `arr' undeclared
展开
 我来答
旗菲丽2
2012-01-22
知道答主
回答量:16
采纳率:0%
帮助的人:6万
展开全部
正如楼上所说变量a,b没定义
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
yangsaha
2012-01-22 · TA获得超过144个赞
知道答主
回答量:184
采纳率:0%
帮助的人:48.4万
展开全部
arr [ ][ ]
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
?>

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式