求指出问题!这是网页系统给的错误提示:
main.c:10:9: Error: Invalid memory access at 0x200000(object '*(a+0)')
a[m] = n%10;
我在Dev-C++上能够运行,但是数字一旦达到6位数,最后数组输出时a[5]都为0,求解答!
#include <stdio.h>
int main()
{
int n,m=0,a[m];
scanf("%d",&n);
if(n<0){printf("fu ");n=-n;}//输出负号
for(;n>0;n = n/10)//遍历数组,把数字拆开依次存入数组
{
a[m] = n%10;
printf("%d %d",m,a[m]);
m++;
}
for(m--;m>=0;m--)//遍历数组,从后往前把数组数字转换成拼音
{
switch(a[m])
{
case 0:printf("ling ");break;
case 1:printf("yi ");break;
case 2:printf("er ");break;
case 3:printf("san ");break;
case 4:printf("si ");break;
case 5:printf("wu ");break;
case 6:printf("liu ");break;
case 7:printf("qi ");break;
case 8:printf("ba ");break;
case 9:printf("jiu ");break;
}
}
return 0;
}