首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

,malloc分配内存有关问题

2012-03-22 
求助,malloc分配内存问题C/C++ code#include stdio.h#include stdlib.h#define N 250000000int main()

求助,malloc分配内存问题

C/C++ code
#include <stdio.h>#include <stdlib.h>#define N 250000000int main(){    int i;     double *x;    if(!(x = malloc(N * sizeof(double)) ))            printf("memory error \n");free(x);}



总是说内存错误,我有8G内存呀。为何会这样呢,如何解决呀?

[解决办法]
如果有一天,你老无所依,……哦不,你真需要比如64GB的数组的话,可以用文件读写模拟内存读写,用_lseeki64函数移动文件读写位置。

热点排行