APL/Fun/NewMalloc/newmem.c

15 lines
259 B
C
Raw Normal View History

2022-10-05 11:07:41 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "newmem.h"
void* newmalloc(size_t size) {
void* start = sbrk(0);
void* finish = sbrk(size);
printf("%d\n", finish);
if (start == finish) return NULL;
return finish;
}