This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
替换:
与
Replace:
with
“ C”是具有数组类型
char [2]
的字符字面字符。它在内存中表示,例如数组{'c','\ 0'}
。用作初始化器表达式,它被隐式转换为指针,转换为其类型char *
的第一个元素。因此,在此声明中,您
要试图初始化对象
z
具有类型char
的指针的指针chode> char *。您需要使用字符串字符串,您需要使用一个整数字符常数,例如
printf
这样的呼叫中的length Modifier
l
以这种格式%lf
是多余的,没有效果。您也可以写作,您应该在
printf
的调用中将指针投入到类型void *
了
printf
的呼叫,似乎代替 意思是这个电话
"c" is a character literal having the array type
char[2]
. It is represented in memory like array{ 'c', '\0' }
. Used as an initializer expression it is implicitly converted to a pointer to its first element of the typechar *
. So in this declarationthat is equivalent to the declaration
you are trying to initialize the object
z
having the typechar
with a pointer of the typechar *
. Instead of the string literal you need to use an integer character constant likeIn calls of
printf
like thisthe length modifier
l
in this format%lf
is redundant and has no effect. You may writeAlso you should cast pointers to the type
void *
in calls ofprintf
like thisAnd it seems instead of this call of
printf
you mean this call