※ 引述《pent.bbs@bbs.wretch.cc (K')》之銘言:
> /*what is wrong with this program ? */
> #include <stdio.h>
> #include <stdlib.h>
> int main()
> {
> double *list;
> int i , howmany;
> printf("How many numbers? => ");
> scanf("%d", &howmany);
> printf("Enter %d numbers. => ", howmany);
> for (i = 0; i < howmany; ++i){
> scanf("%lf", &list[i]);
你的 list 沒有配置記憶體來使用.
list = (double *) malloc(howmany * sizeof(double);
順便查一下你的 malloc() 是宣告於那個 header 檔案,請一併引入該
include header 敘述.
--
真誠最可貴 用心最踏實
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: kendlee.sayya.org