Created
October 8, 2008 04:33
-
-
Save tokuhirom/15446 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
int main (int argc, char**argv) { | |
// ./a.out malloc 10000 100000 | |
int count = atoi(argv[2]); | |
int size = atoi(argv[3]); | |
printf("count: %d, size: %d\n", count,size); | |
if (argv[1][0] == 'm') { | |
for (int i=0; i<count; i++) { | |
malloc(size * sizeof(int)); | |
} | |
} else { | |
for (int i=0; i<count; i++) { | |
calloc(size, sizeof(int)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment