大きすぎる配列の割り当て
Posted: 2010年11月21日(日) 06:38
CLAS構造体の配列の中のSTUDENT構造体にアクセスしたかったのですが
CLAS配列の要素を大きくするとクラッシュしてしまいました。
なにか原因があるのでしょうか?
ちなみにCLAS配列の要素は20×20ほど準備しておきたかったです。
コンパイラはBorland C++ Compiler
処理系は Windows Vista SP2
=========================コード=======================================
#include <stdio.h>
#include <string.h>
#include <windows.h>
typedef struct{
int count;
char a[512];
char b[512];
char c[512];
char d[512];
char e[10];
int f[6];
char g[1024];
int h;
int i;
int j;
}STUDENT;
typedef struct{
STUDENT st[40];
int count;
}CLAS;
int main()
{
//csv読み書き用の配列
STUDENT table[300];
//格納先
CLAS matrix[20][20];
matrix[1][1].st[1].count=1;
printf("%d",matrix[1][1].st[1].count);
return 0;
}
==============================================================================
CLAS配列の要素を大きくするとクラッシュしてしまいました。
なにか原因があるのでしょうか?
ちなみにCLAS配列の要素は20×20ほど準備しておきたかったです。
コンパイラはBorland C++ Compiler
処理系は Windows Vista SP2
=========================コード=======================================
#include <stdio.h>
#include <string.h>
#include <windows.h>
typedef struct{
int count;
char a[512];
char b[512];
char c[512];
char d[512];
char e[10];
int f[6];
char g[1024];
int h;
int i;
int j;
}STUDENT;
typedef struct{
STUDENT st[40];
int count;
}CLAS;
int main()
{
//csv読み書き用の配列
STUDENT table[300];
//格納先
CLAS matrix[20][20];
matrix[1][1].st[1].count=1;
printf("%d",matrix[1][1].st[1].count);
return 0;
}
==============================================================================