[問題] 遇到奇怪的陣列問題
由於自己本身沒有什麼程式的底子,
大部分都是有需要才邊寫邊摸出來的,
所以平常語法也都亂七八糟混著用,
函式庫很多也不管有沒有用就貼上去....
今天寫到一半的時候遇到個奇怪的問題,
無論怎麼執行都會當掉,
最後終於找到有問題的那行程式碼,
把他獨立出來之後變成下面這樣:
=====================================
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include <cstdlib>
#include <ctime>
#include <windows.h>
using namespace std;
void Test()
{
int R[15][5][100][101];
}
main()
{
Test();
system("PAUSE");
return 0;
}
========================================
原本想說會不會是陣列設的太大,
但在無聊亂測的結果卻發現,
把這行移到上面的話就可以正常執行,
就像下面這樣:
========================================
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include <cstdlib>
#include <ctime>
#include <windows.h>
using namespace std;
int R[15][5][100][101];
void Test()
{
}
main()
{
Test();
system("PAUSE");
return 0;
}
========================================
由於我進行的演算法非常有必要用到這個陣列,
而且其他部份也都完成了,
不知是否能在盡量不影響結構的情況下解決這個問題?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.75.38
推
06/13 17:53, , 1F
06/13 17:53, 1F
→
06/13 17:55, , 2F
06/13 17:55, 2F
→
06/13 17:56, , 3F
06/13 17:56, 3F
→
06/13 18:02, , 4F
06/13 18:02, 4F
推
06/13 18:02, , 5F
06/13 18:02, 5F
→
06/13 18:03, , 6F
06/13 18:03, 6F
→
06/13 18:03, , 7F
06/13 18:03, 7F
推
06/13 18:07, , 8F
06/13 18:07, 8F
→
06/13 18:08, , 9F
06/13 18:08, 9F
→
06/13 18:08, , 10F
06/13 18:08, 10F
→
06/13 18:09, , 11F
06/13 18:09, 11F
→
06/13 18:10, , 12F
06/13 18:10, 12F
→
06/13 18:11, , 13F
06/13 18:11, 13F
推
06/13 22:17, , 14F
06/13 22:17, 14F
→
06/13 22:18, , 15F
06/13 22:18, 15F
→
06/13 22:20, , 16F
06/13 22:20, 16F
→
06/13 22:20, , 17F
06/13 22:20, 17F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章