Skip to content

Instantly share code, notes, and snippets.

@jozadaquebatista
Forked from bricef/alloc.c
Created October 7, 2015 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jozadaquebatista/5ad6dbb9c44ecb3564ba to your computer and use it in GitHub Desktop.
Save jozadaquebatista/5ad6dbb9c44ecb3564ba to your computer and use it in GitHub Desktop.
#include <stdio.h>
#if defined(SMALL)
#define SIZE 30
#endif
#if defined(LARGE)
#define SIZE 3000
#endif
static char buf[SIZE];
void main(){
printf("%d\n", sizeof(buf));
}
➤ gcc -DLARGE alloc.c -o LARGE.prog
➤ gcc -DSMALL alloc.c -o SMALL.prog
➤ ls -l
total 48
[...]
-rwxr-xr-x 1 brice users 7573 Apr 3 23:25 LARGE.prog
-rwxr-xr-x 1 brice users 4901 Apr 3 23:25 SMALL.prog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment