This question shows research effort; it is useful and clear
0
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
我在使用 malloc 分配 16777216 (16mb) 并尝试迭代该数组 n 次时遇到分段错误。我似乎无法找到为什么我遇到分段错误..
register *a;
a = malloc(16777216);
int times, i, dummy, timeTaken;
for (times = 0; times < 10000; times++) {
for (i = 0; i < 16777216; i += 1) {
dummy = a[i];
}
}