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