[問題] heap curruption
一段很簡單的code..
用動態陣列
會報This may be due to a corruption of the heap, which indicates a bug
in a.exe or any of the DLLs it has loaded.
int main(void){
long n;
double *P;
P = new double[];
double *R;
R = new double[];
cout<<"n";
cin>>n;
for(long i=0;i<n;i++){
cout<<endl<<"P"<<i<<" =";
cin>>P[i];
}
for(long i=0;i<n;i++){
R[i]=100/P[i];
}
system("pause");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 42.70.0.107
→
03/10 22:58, , 1F
03/10 22:58, 1F
推
03/10 23:53, , 2F
03/10 23:53, 2F
→
03/10 23:55, , 3F
03/10 23:55, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章