APL/Fun/NewMalloc/newmem.c
2022-10-05 11:07:41 +02:00

15 lines
259 B
C

#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;
}