【发布时间】:2016-11-01 17:55:45
【问题描述】:
我正在尝试用 C 语言对微芯片进行编程。现在我正在努力更新 LCD 屏幕上的一行,但它无法正常工作。任何人都可以对此有所了解吗?
float slope = 0.0626;
char *mystring;
int8_t LCDline1[20];
void myfunction(){
sprintf(*mystring, "%ld", (long)(slope * 10000));
memcpy(LCDline1, *mystring, strlen(*mystring)+1);
}
当我运行编译代码时,出现以下三个错误。
calibrate.c:60:5: warning: passing argument 1 of 'sprintf' makes
pointer from integer without a cast. note: expected 'char *'
but argument is of type 'char'
calibrate.c:61:5: warning: passing argument 1 of 'strlen' makes
pointer from integer without a cast. note: expected 'const char *'
but argument is of type 'char'
calibrate.c:61:5: warning: passing argument 2 of 'memcpy' makes
pointer from integer without a cast. note: expected 'const void *' but
argument is of type 'char'
我不确定我做错了什么,我使用以下定义作为我的起点
void *memcpy(void *str1, const void *str2, size_t n)
size_t strlen(const char *str)
char *p = "String";
【问题讨论】: