Text based database

Is your database static or dynamically changing?

Static pre-allocation of memory and assignment to a pointer is done like thisconst char * str = “hello”that assigns just the right number of bytes

If you have an array of struct, that works the same way the pointer to the statically allocated c-string will be assigned to an entry

struct data_t {
  const  char * message ;
  int x;
};

data_t data[] = {
   {“Hello”, 10},
   {“World”, 20}
};

For dynamic memory allocation search for malloc()