if (answer == 'Y') {
int a, u, l;
printf("How many numbers do you need?\n");
scanf("%d", a);
程序在此行後崩潰。我應該用什麼來代替「%d」?格式'%d'需要'int *'類型的參數,但參數的類型爲'int'
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教程()'應該解釋清楚。 – Barmar