看板 C_and_CPP 關於我們 聯絡資訊
#include <iostream> using namespace std; struct SAbc { int a; float b; SAbc *next; }; int main(int argc, char *argv[]) { SAbc *a = new SAbc(); a->a = 10; a->b = 3.6f; return 0; } 呃,我這樣的程式執行起來並沒有任何錯誤耶。(MS VS 2005) 你要不要貼出更多的程式碼呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.171.137
shaill:這我也有嘗試過...在main new一個instance~也沒有錯誤.. 09/11 21:16
shaill:但是我就是在另一個class的function有new一個這struct..就 09/11 21:17
shaill:出錯了.. 09/11 21:17
james732:把你的程式碼多放一點上來吧 09/11 21:19
shaill:我懷疑可能是我class有地方寫錯..也不是不放..是太多很難放 09/11 21:27
shaill:只是不知道是什麼錯誤..因為我新開一個class..也是在functi 09/11 21:30
shaill:在function中new那struct..卻沒事..可能是原本我new太多嗎. 09/11 21:31