Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
c ++費氏數列
Jul 13th 2013, 19:56

/*13-4-1 費氏數列 動態記憶體*/
#include
#include
int main (void)
{
int *a,n,i;
printf ("請輸入您想要幾項");
scanf ("%d",&n);
a= (int*) malloc(n*sizeof(int*));
for (i=0;i
{
if (i == 0 || i == 1)
{
*a =1;
printf ("%-3d\n",*a);
}
else{
*a = *(a-sizeof(int*))+*(a-sizeof(int*)*2);
printf("%-3d\n",*a);
}
}
system ("pause");
free(a);
return 0;
}

各位大大
小的剛學c++
小的不知到哪裡錯了
雖然跑出來得直是對的
但是成是馬上就出問題
麻煩幫我debug
謝謝
是因為free 沒有放在迴圈中嘛!??

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 gyyij7s6y6fly 的頭像
    gyyij7s6y6fly

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

    gyyij7s6y6fly 發表在 痞客邦 留言(0) 人氣()