Skip to content

Instantly share code, notes, and snippets.

@rohitx007
Last active September 16, 2018 20:26
Show Gist options
  • Save rohitx007/f28a05b717e30098a3816c19740b1957 to your computer and use it in GitHub Desktop.
Save rohitx007/f28a05b717e30098a3816c19740b1957 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
if(argc !=2){
printf("Size of Memory \n");
return 0;
}
long long int size = (long long int) atoi(argv[1]);
long long int sizeBytes = size*1024*1024;
int* array = malloc(sizeBytes);
int number = sizeBytes/(sizeof(int));
int itr =0;
while(1){
array[itr] = 0;
itr++;
if(itr>=number){
itr=0;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment