線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:5327
推到 Plurk!
推到 Facebook!

顯示 Access violation at address 的錯誤

答題得分者是:aftcast
wander7617
一般會員


發表:4
回覆:6
積分:2
註冊:2009-10-10

發送簡訊給我
#1 引用回覆 回覆 發表時間:2009-10-10 12:55:10 IP:123.192.xxx.xxx 訂閱
我剛開始練習寫BCB
執行程式後顯示了

Project Project1.exe raised execption class EAccessViolation with massage 'Access violation at address 01193E3B in module BORLNDMM.DLL Write of address 012D2250' . Process stopped. Use Step or Run to continue.

以下是我的程式碼

void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i;
int *a;
a = new int[StrToInt(Edit1->Text)];
Series1->Clear();
for(i=1;i<=StrToInt(Edit1->Text);i )
{
a[i] = i;
Series1->AddXY(i,a[i]);
}
}

請問這是哪裡出了問題呢?
aftcast
站務副站長


發表:81
回覆:1485
積分:1763
註冊:2002-11-21

發送簡訊給我
#2 引用回覆 回覆 發表時間:2009-10-11 23:38:37 IP:61.219.xxx.xxx 訂閱
如果 

a = new int[3];

那 i 應該是 0 至 2 共三個,而非 1至3 三個!!!

for 有問題,了嗎?

===================引 用 wander7617 文 章===================
我剛開始練習寫BCB
執行程式後顯示了

Project Project1.exe raised execption class EAccessViolation with massage 'Access violation at address 01193E3B in module BORLNDMM.DLL Write of address 012D2250' . Process stopped. Use Step or Run tocontinue.

以下是我的程式碼

void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i;
int *a;
a = new int[StrToInt(Edit1->Text)];
Series1->Clear();
for(i=1;i<=StrToInt(Edit1->Text);i )
{
a[i] = i;
Series1->AddXY(i,a[i]);
}
}

請問這是哪裡出了問題呢?
------


蕭沖
--All ideas are worthless unless implemented--

C++ Builder Delphi Taiwan G+ 社群
http://bit.ly/cbtaiwan
wander7617
一般會員


發表:4
回覆:6
積分:2
註冊:2009-10-10

發送簡訊給我
#3 引用回覆 回覆 發表時間:2009-10-11 23:39:46 IP:123.192.xxx.xxx 訂閱
謝謝
系統時間:2024-04-26 14:55:11
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!