blob: 35237b283408f87583af4099924427844232d07f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// buffer.c - Example usage of buffer.h dynamic buffer
#define BUFFER_IMPLEMENTATION
#include "../include/buffer.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
void *buf = buffer_malloc(10, sizeof(int));
if (!buf) {
fprintf(stderr, "Failed to allocate buffer\n");
return 1;
}
printf("capacity: %" PRIu64 "\n", buffer_capacity(buf));
printf("size: %" PRIu64 "\n", buffer_count(buf));
buffer_free(buf);
return 0;
}
|