请问各位,我有下面这个函数,
void read(unsigned char a[3]);
赋值后,read("我");VC编译系统说我错误,而我在函数体内定义 unsigned char a[3]="我",这样是没有错误的;
另外在tc的编译系统里这样的定义void read(unsigned char *ch);这样赋值read("我");是没有问题,而在VC里提示can't convert char * to unsigned char *;
不知道是什么原因,有什么办法解决吗?谢!
void read(unsigned char a[3]);
赋值后,read("我");VC编译系统说我错误,而我在函数体内定义 unsigned char a[3]="我",这样是没有错误的;
另外在tc的编译系统里这样的定义void read(unsigned char *ch);这样赋值read("我");是没有问题,而在VC里提示can't convert char * to unsigned char *;
不知道是什么原因,有什么办法解决吗?谢!
read((unsigned char*)"我");
而你这里是把常量转换成非常量,又把char*转换成unsigned char*,肯定是报错的tc比较老,类型检查不够严格