I need some help when we think about a task.
My task is to create one memory area
void *memory = malloc(320);
then use pointers to store texts in this storage location. We want to divide this area into 32 byte data blocks so that we can store: 320/32 = 10 data blocks - 32 bytes. In one data block I can store (1 ASCSII char = 1 byte) 32 characters.
I have a 10 bitmap where each bit indicates whether a data block is used (1) or not (0).
But what if I want to save text 60 characters long? Then I need 2 data blocks (2 x 32 bytes). The bitmap shows that data blocks 2 and 6 are free, 1 and 6 are not side by side. How can I achieve this?
struct data {
char * text;
};
typedef struct data d;
d->text = ???