static_malloc.c revision 663860b1408516d02ebfcb3a9999a134e6cfb223
1#include <stdio.h>
2
3static char buf[10000];
4static int bufi = 0;
5void* malloc(size_t i) {
6   bufi += i;
7   return buf + bufi - i;
8}
9
10void free(void*ptr) {
11}
12
13int main (void)
14{
15   char *p;
16   p = malloc(10);
17   p = malloc(123);
18   free(p);
19   return 0;
20}
21
22