Last active
October 6, 2016 19:06
-
-
Save Pithikos/624198ae875ac802870a7a5659c50e73 to your computer and use it in GitHub Desktop.
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <unistd.h> | |
/* | |
Malloc memory of argv sizes with an interval of 10ms in between. | |
*/ | |
int main(int argc, char **argv) | |
{ | |
int i, j, memsize; | |
int *mems[100]; | |
struct timespec ms10; | |
ms10.tv_sec = 0; | |
ms10.tv_nsec = 10000000; | |
i = 0; | |
for(i; i < argc-1; i++){ | |
memsize = atoi(argv[i+1]); | |
mems[i] = malloc(memsize*sizeof(int)); | |
j = 0; | |
for (j; j < memsize; j++){ | |
mems[i][j] = j; | |
} | |
nanosleep(&ms10, NULL); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment