本当にシンプルに見えますが、char配列の一見無作為な場所が8で正しく埋められていません。コンパイラエラーもありません。私はこのようなノブの質問だと申し訳なく思っていますが、私は1ヶ月前にスドクソルバーを設計したとき、これとほぼ同じコードを実行するのに何の問題もありませんでした。このシンプルな文字フィラーは何が問題なのですか?
#include <iostream>
using namespace std;
int main() {
//Initiates initial board.
char board[30][27];
//Fills entire board with b's to represent the edges of the board where the pac-man cannot go.
for (int control=0; control<31; control++) {
for (int control2=0; control2<28; control2++) {
board[control][control2]='8';
}
}
//Code here filling the board with spaces representing where the pac-man can go.
//Temporary render of board.
for (int control=0; control<31; control++) {
for (int control2=0; control2<28; control2++) {
cout << board[control][control2];
}
cout << endl;
}
return 0;
}
明らかにランダムなセグメント化エラーがあります。
私はデバッガを持っています。それは正常に終了しました。 –
いいえ、そうではありませんでした。 –
端末の中にありました。デバッガ自体は何も返しませんでした。実行時に、端末はセグメント化障害で停止しました。 –