Reputation: 35
I have a struct in struct array inside another struct array and need to access values in this struct.
typedef struct unit
{
bool isNot;
char letter;
} unit;
typedef struct line
{
unit *clause;
int lineLength;
} line;
typedef struct fullData
{
line **table;
} fullData;
I am trying to access a unit struct i have created like so:
struct fullData Block;
struct Line lines;
and then to access:
Block.table[i][j].letter
to get the letter in the unit struct.
This is kinda abridged, but the 2d array is massively populated.
Upvotes: 1
Views: 58
Reputation: 5467
If I understand you correctly, I think you are trying to store letters in each cell of a table. Make the line **table
as line *table
. Then you can use Block->table[i]->clause[j]->letter
to access letter at i
and j
. This makes more sense as a table is an array of lines and a line is an array of letters.
Upvotes: 2