[問題] free會引起crash
宣告一個class complex 內有+-*/
typedef real double;
class complex {
public :
real Re;
real Im;
complex(real a, real b);
complex();
complex operator+(complex);
complex operator+(real);
complex operator-(complex);
:
:
};
complex Eular(real );
complex abs(complex );
現在開始用這class做些計算
complex *y;
y = (complex*)calloc(n,sizeof(complex));
:
:
:
TF[i] = abs(y[i]) ....
free(y);
編譯可過,但會掛在math.h裡面的 abs中
查找了半天,發現把free那行comment out掉就沒事
那請問為何會這樣哩QQ
是這樣我就無法free記憶體了嗎QQ thx
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.117.67.58
※ 編輯: Carbontube 來自: 59.117.67.58 (03/21 15:52)
推
03/21 16:06, , 1F
03/21 16:06, 1F
推
03/21 16:38, , 2F
03/21 16:38, 2F
推
03/21 17:52, , 3F
03/21 17:52, 3F
→
03/21 18:41, , 4F
03/21 18:41, 4F
推
03/21 20:53, , 5F
03/21 20:53, 5F
→
03/22 03:59, , 6F
03/22 03:59, 6F
→
03/22 03:59, , 7F
03/22 03:59, 7F
→
03/22 04:00, , 8F
03/22 04:00, 8F
推
03/22 09:08, , 9F
03/22 09:08, 9F
推
03/24 01:54, , 10F
03/24 01:54, 10F
→
03/24 01:55, , 11F
03/24 01:55, 11F
→
03/24 01:56, , 12F
03/24 01:56, 12F
推
03/24 01:58, , 13F
03/24 01:58, 13F
→
03/24 01:59, , 14F
03/24 01:59, 14F
→
03/24 02:00, , 15F
03/24 02:00, 15F
推
03/24 23:15, , 16F
03/24 23:15, 16F
→
03/26 00:42, , 17F
03/26 00:42, 17F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章