【发布时间】:2013-09-14 03:18:10
【问题描述】:
我有这个 C 代码:
#include <stdio.h>
#include <stdlib.h>
int main(){
char *bitstr;
printf("Enter a bitstring or q for quit: ");
scanf("%s", &bitstr);
return 0;
}
我不断收到以下错误。我究竟做错了什么?
warning: format '%s' expects argument of type 'char *', but
argument 2 has type 'char **' [-Wformat]
【问题讨论】:
-
错误信息似乎不言自明...
-
你还需要用
malloc()初始化bitstr。 -
这能回答你的问题吗? Example: scanf and char errors