Skip to content

Instantly share code, notes, and snippets.

@keyurdg
Created May 28, 2013 05:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keyurdg/5660723 to your computer and use it in GitHub Desktop.
Save keyurdg/5660723 to your computer and use it in GitHub Desktop.
Allocate some memory
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv) {
size_t i = atoi(argv[1]) * sizeof(int);
int *ptr = malloc(i);
bzero(ptr, i);
fprintf(stdout, "Allocated %u bytes\n", i);
fflush(stdout);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment