【发布时间】:2013-09-16 07:35:04
【问题描述】:
谁能告诉我这里出了什么问题?
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define ERROR 0
#define MAX_INPUT_LINE 80
#define print(x) {fputs(x,stdout);}
#define SUCCESS 1
int main (long argc, char *argv[])
{
int mode;
printf("1 for hexidecimal or 2 for binary");
scanf("%d", mode);
printf("\n\n\nThe value of mode is %d\n", mode);
return 0;
}
当我为二进制输入 2 时,我得到了这个:
The value of mode is 2665564
显然我应该得到 2,我做错了什么?它是我的编译器,是因为我使用的是 Cygwin 吗?为什么不是模式2??
【问题讨论】:
-
你做错的是忽略你的编译器警告信息。
标签: c unix compiler-construction printf scanf