Added another examples for Chapter 9

This commit is contained in:
Fabio Scotto di Santolo
2025-08-21 12:38:20 +02:00
parent dfa3ee19b8
commit 04b33c03ef
5 changed files with 282 additions and 48 deletions

16
chp9/test_malloc.c Normal file
View File

@@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int main(void) {
char *buf = (char *)malloc(256);
if (!buf) {
perror("malloc");
return 1;
}
size_t size = malloc_usable_size(buf);
printf("%d\n", size);
free(buf);
return 0;
}