Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by ( 18 years ago )
#include <stdio.h>
#include <stdlib.h>
const int num_iterations = 1000;
void print_usage() {
puts("syntax errorn");
}
int main(int argc, char** argv) {
if (argc != 2) {
print_usage();
exit(-1);
}
int tot = atoi(argv[1]);
int i, j;
size_t tot_size = tot * sizeof(int);
printf("Allocating %u bytesn", tot_size);
int* data = calloc(tot_size, 1);
for (i = 0; i < num_iterations; i++) {
for (j = 0; j < tot; j++) {
data[j] += i;
}
}
return 0;
}
Revise this Paste