I've read i can't really dynamically allocate an array in pascal but i'm also thinking of implementing a string struct.
In C, i would go about it by creating a struct containing a pointer to an array of chars (containing the characters), a length integer and a size one. I would then malloc the char * and realloc it when it needs to be resized.
typedef struct {
size_t size;
size_t length;
char* contents;
} String;
Can this be done in (ISO) pascal? If so, how would one go about it? I don't want to use a built-in pascal dynamic array because it kind of defeats the purpose of making my own string type.
From comments, it seems like ISO pascal (both standard and extended) doesn't support such things. How do i do it in free pascal then?
contentscannot be allocated in a conforming program. The Extended Pascal (ISO 10206) does not have them either. - Doj