C语言指针问题

#include<iom16v.h>#include<macros.h>//字符库定义#pragmadata:codeconstunsignedcharEnglishCo... #include <iom16v.h>
#include <macros.h>
//字符库定义
#pragma data: code
const unsigned char EnglishCode[]={
0x2e, //字符001
0x2e, //字符002

0x43, //字符003
};
flash unsigned int ChineseCode[]={
0xccab, //字符1

0xd7d3 //字符5
};
const unsigned char EnglishCharDot[]={
0x00,....,/*[_]0x20 */
0x10,.....,/* 1 0x25 */
};
const unsigned char ChineseCharDot[]={
0x10,0x00,......,0xA0,0x40,0x2F,,0x00,/*"保",0*/
0x7E,.......0x40,0x84,0x40,,0x08,/*"闭",1*/
0x10,0x40,...,0x08,0x84,/*"编",2*/
0x08,0x40,....,0x00,/*"裁",3*/
};
#pragma data:data

//-------------------------------------------------------------------------------
void putchar(unsigned int c) //定位写字符子程序
{ if(c>128)
putsizeimage(CHINESECHARSIZE,CHINESECHARSIZE,getchinesecodepos(c));
else
putsizeimage(ENGLISHCHARSIZE,CHINESECHARSIZE,getenglishcodepos(c));
}
//-------------------------------------------------------------------------------
void putstr(unsigned char *s)
{ unsigned int c;
while(1)
{ c=*s;
s++;
if(c==0) break;
if(c<128)
putchar(c);
else
{ putchar(c*256+*s);
s++;
}
}
}
//-------------------------------------------------------------------------------
unsigned char *getchinesecodepos(unsigned int ac)
{ unsigned int min,max,mid,midc;
min=0;
max=CHINESECHARNUMBER-1;
while(1)
{ if(max-min<2)
{ if(ChineseCode[min]==ac)
mid=min;
else if(ChineseCode[max]==ac)
mid=max;
else
mid=0;
break;
}
mid=(max+min)/2;
midc=ChineseCode[mid];
if(midc==ac)
break;
else if(midc>ac)
max=mid-1;
else
min=mid+1;
}
return ChineseCharDot + mid * CHINESECHARDOTSIZE; 这里出问题
}
//-------------------------------------------------------------------------------
unsigned char *getenglishcodepos(unsigned char ac)
{ unsigned char min,max,mid,midc;
min = 0;
max = ENGLISHCHARNUMBER-1;
while(1)
{ if(max-min<2)
{ if(EnglishCode[min]==ac)
mid=min;
else if(EnglishCode[max]==ac)
mid=max;
else
mid=0;
break;
}
mid=(max+min)/2;
midc=EnglishCode[mid];
if(midc==ac)
break;
else if(midc>ac)
max=mid-1;
else
min=mid+1;
}
return EnglishCharDot+mid*ENGLISHCHARDOTSIZE; 这里出问题
}
ERR:illegal return type; found `pointer to const unsigned char' expected `pointer to unsigned char'
把字库放在FLASH里面就出现了 这个怎麼解决啊 搞好好久了
展开
 我来答
人工智能研习社
2012-12-19 · TA获得超过237个赞
知道小有建树答主
回答量:216
采纳率:0%
帮助的人:238万
展开全部
类型不一样,把EnglishCharDot的定义前面的const去掉应该就可以了吧。
更多追问追答
追问
去掉不达不到要求了 本来就是要把数组存在FLASH里面的
追答
那你需要返回unsigned char  *类型的话, 那你可以把EnglishCharDot中的内容拷贝到内存里,然后再返回。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式