函数1:unsigned char *a(unsigned char number)
{
unchar arry[4];
arry[0]=number+3;
arry[1]=number+2;
arry[2]=number+1;
arry[3]='\0';
p=arry;
return p;
}
函数2:void lcd_display(unsigned char h,unsigned char w,unsigned char *q)
{
while(*q!='\0')
{
....................
}
}
主函数:lcd_display(0,0,a(12));
如上调用时,keil 没有警告和错误,但是不会进入到函数2的while()循环中去的,但是在函数1中直接给p赋值:p="123",while()循环可以进入,难道将数组arry不能直接赋给指针p?
还望大神门能够指点迷津 |