so I currently have a struct that looks like this:
typedef struct example {
bool arr[]; //i would like this to be an array of booleans,
//but i don't know the size right now; this is
//probably wrong
} example_t;
I also have a create function that looks like this:
example_t *newExample(int SIZE){
example_t *example = malloc(sizeof(example_t));
//initialize arr to a bool array of size SIZE, ideally all false!
example->arr = ???
return example;
}
And from this, I would be able to do something like:
example_t *example = newExample(MAX);
if ( example->arr[10] )
....
Is this possible in C, to create a variable sized array of booleans?
For Reference: I need someway to map integers to either a char* or bool, so I can call arr[num] and be able to get either a string/word or a true/false value. Both ways, I'm not sure how to declare, and then initialize with a variable size. Thanks in advance!