/* SPDX-License-Identifier: MIT */ #include #include #include #define rb_size_t size_t #include "ringbuf.h" int main(void) { struct RingBuf rb; rb_init(&rb, 10, malloc, sizeof(int)); int data[] = { 5, 6, 7, 8 }; printf("Address at first element: %p\n", &data[0]); rb_push(&rb, data, 4, memcpy); // Print addresses of data for (int i = 0; i < 4; i++) { printf("Address: %u\n", &data[i]); } print_seq(data, 4); print_seq(rb.buffer, 4); int dest[5]; // rb_read(&rb, (void *)dest, 5); // for (int i = 0; i < 5; i++) { // printf("Data: %d\n", dest[i]); // } rb_destroy(&rb, free); return 0; }