小编Jen*_*inx的帖子

如何让笔记本电脑拥有如此多的内存?

我搞乱了malloc调用,我想知道我的操作系统能给你多少内存.我试过了:

int main() {
    char *String = 0;
    String = malloc (100000000000000); // This is 10^14
    if (String)
        printf ("Alloc success !\n");
    else
        printf ("Alloc failed !\n");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

而且......它奏效了.10 ^ 14大约是18太字节.笔记本电脑是否有可能拥有如此多的内存?如果那不可能,怎么解释呢?

c memory malloc

5
推荐指数
1
解决办法
103
查看次数

标签 统计

c ×1

malloc ×1

memory ×1