array size too large
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/06 07:47:24
array size too large
/* Note:Your choice is C IDE */
#include "stdio.h"
#define N 100
typedef struct
{int a;
char b[10];
}name;
typedef struct
{int date;
name c[N];
}fornie;
void main()
{ //flushall();
fornie ci[N];
scanf("%d",&(ci[1].c[1].a));
printf("%d",ci[1].c[1].a);
}
这样的结构体定义,太占内存,怎么样定义,可以少占内存呢?
/* Note:Your choice is C IDE */
#include "stdio.h"
#define N 100
typedef struct
{int a;
char b[10];
}name;
typedef struct
{int date;
name c[N];
}fornie;
void main()
{ //flushall();
fornie ci[N];
scanf("%d",&(ci[1].c[1].a));
printf("%d",ci[1].c[1].a);
}
这样的结构体定义,太占内存,怎么样定义,可以少占内存呢?
Array size too large (数组太大)
分析与处理:定义的数组太大,超过了可用内存空间.
可能是你的可用内存空间太小,这个程序在我的电脑上运行是没有问题的.
你可以把N改小一点.
补充:你这样定义的话,因为name数组完全包含在fornie结构体中,而数组在内存中是连续存储的,故所需的整块空间较大.我们可以用指针来指向name创建的变量,然后将这个指针保存在fornie结构体中,这样所需的空间就会分成两大块:
fornie数组是一整块;name创建的变量是分散在内存中存储的,此时没有生成name数组.
修改的程序如下:
#include
#define N 100
typedef struct name
{int a;
char b[10];
}name;
typedef struct fornie
{int date;
name* c; //这里用指针
}fornie;
void main()
{ //flushall();
int i;
fornie ci[N];
for(i=0;ia));
printf("%d",(ci[1].c->a));
}
分析与处理:定义的数组太大,超过了可用内存空间.
可能是你的可用内存空间太小,这个程序在我的电脑上运行是没有问题的.
你可以把N改小一点.
补充:你这样定义的话,因为name数组完全包含在fornie结构体中,而数组在内存中是连续存储的,故所需的整块空间较大.我们可以用指针来指向name创建的变量,然后将这个指针保存在fornie结构体中,这样所需的空间就会分成两大块:
fornie数组是一整块;name创建的变量是分散在内存中存储的,此时没有生成name数组.
修改的程序如下:
#include
#define N 100
typedef struct name
{int a;
char b[10];
}name;
typedef struct fornie
{int date;
name* c; //这里用指针
}fornie;
void main()
{ //flushall();
int i;
fornie ci[N];
for(i=0;ia));
printf("%d",(ci[1].c->a));
}
array size too large
Sorry,it's too small.You have a _______ (large) size.don't y
Texture is too large:2048x2048,maximum suppoted size:1024x10
large size和big size的区别
large,trailer-size shelters是什么意思?
Message size too
SEGMENT TOO LARGE 错误
The large size of the world中文翻译?
append buffers are too large
file too large to preview
英语中 .of large size 谁知道什么意思?跪求、、、、
The shirt is _ in small,medium and large size.