为什么下面的代码直接显示Mb占用的堆:
int Mb = 0;
while ( malloc(1<<20)) ++Mb;
printf("Allocated %d Mb total\n", Mb);
1<<20
是什么意思?
最佳答案
What is meant by
1<<20
?
A 1,左移20位,又称为2^20 = 1048576。<<
是向左移动的位移运算符。
关于c - malloc() 打破循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13202836/