下面的语句的问题在哪?
char lleny[13];
short GetNum(char *llen)
{
int i;
short a;
switch(llen[i])
{
case '1':
a=1;
break;
case '2':
a=2;
break;
case '3':
a=3;
break;
case '4':
a=4;
break;
case '5':
a=5;
break;
case '6':
a=6;
break;
case '7':
a=7;
break;
case '8':
a=8;
break;
case '9':
a=9;
break;
case '0':
a=0;
break;
}
return a;
}
Form1->a1=GetNum(lleny)*10+GetNum(lleny+1);
Form1->a2=GetNum(lleny+2)*10+GetNum(lleny+3);
Form1->a3=GetNum(lleny+4)*10+GetNum(lleny+5);
Form1->a4=GetNum(lleny+6)*10+GetNum(lleny+7);
Form1->a5=GetNum(lleny+8)*10+GetNum(lleny+9);
Form1->a6=GetNum(lleny+10)*10+GetNum(lleny+11);
目的是在Edit控件中读取一个字符串,放到数组lleny中,然后将其分解转换后,赋值。
程序很长,没有贴出来,发现就是贴出来的代码有错误,编译可以通过,但运行的时候出现以下错误:Access violation at address 00431f06 in module 'GEMS.exe'.Read of address 01c2a13e.