C语言常见问题–scanf函数的输入问题
在前几天写推箱子的游戏的时候遇到了这个问题.在这里我把这个问题还原出来…并解决…
编译环境 :mac电脑、GCC编译器、VSCode代码编辑器.
第一段代码A
#include <stdio.h>
int main(int argc, char *argv[]) {
int num = 0;
scanf("%d", &num);
printf("src 0X%x, num = %d", num, num);
return 0;
}
运行结果:
bao:day1007 bao$ gcc -o test3 test3.c
bao:day1007 bao$ ./test3
5
src 0X5, num = 5bao:day1007 bao$
第二段代码B
#include <stdio.h>
int main(int argc