我正在尝试获取用户输入,有时可能是“字符串字符串”,其他时候是“字符串int”。但我在sscanf(input,"%d",moves);
的参数3中收到错误,其中指出:
“warning:format''需要类型为''的参数,但参数3的类型为''。
我是C新手并且发现调试相当困难。所以任何帮助都非常感谢!
char *choice = validateStr();
char *tok = strtok(choice," \n");
char *input = strtok(NULL," \n");
int moves = 0;
else if(strcmp(choice, "forward") == 0){
sscanf(input,"%d",moves);
printf("%d",moves);
forward(list,moves);
答案 0 :(得分:1)
sscanf(input,"%d",moves);
应改为
sscanf(input,"%d",&moves);