【发布时间】:2016-09-27 00:12:43
【问题描述】:
if (answer == 'Y') {
int a, u, l;
printf("How many numbers do you need?\n");
scanf("%d", a);
程序在此行之后崩溃。我应该使用什么来代替“%d”?
printf("Specify the lower bound of the range:");
scanf("%d", l);
printf("Specify the upper bound of the range:");
scanf("%d", u);
for(c = 1;c <= a ;c++) {
n = rand() %(u - l) + 1;
printf("%d\n", n);
}
}
【问题讨论】:
-
任何关于使用
scanf()的C 教程都应该清楚地解释这一点。
标签: c