It doesn't matter what the type of set
is, you access it with exmpl.set
. If you need to access a single element it would be exmpl.set[0][0]
for example.
If you need to allocate memory for it, you need to allocate memory for the outer array and then for each inner array independently, like this to create an array of 10x20:
struct Example exmpl;
exmpl.set = malloc(10 * sizeof(char*)); // 10 "arrays" in the set
for (int i = 0; i < 10; i++)
exmpl.set[i] = malloc(20 * sizeof(char)); // 20 chars within each "array"
Then for setting each element's value:
for (int i = 0; i < 10; i++)
for (int j = 0; j < 20; j++)
exmpl.set[i][j] = calculate(i, j);
And, an array and a pointer are different, so what you have here is a pointer to a pointer to char (which works similarly to a 2-dimensional array of chars)