For the following example (from mysql source code), it uses Field **field. I am in trouble to think it as a 2 dimension array of Field.
typedef struct st_table_share
{
.......
Field **field;
....
}
for (Field **field=table->field ; *field ; field++)
{
...
Can I think it in this way, a table contains many rows and a row contains multiple columns/fields. So *field means a row, and **field mean a table?
If that’s true, for the following code
for (Field **field=table->field ; *field ; field++)
it will exit when *field is null, so how could *field be null if *field is a row. Or can I say if a row has 5 columns, and field is the first column, then field+4 is the last column field, and field+5 is the end of the column which means null, so that the for loop will exit?
In declaration syntax, yes.
If the authors of the code take care to preserve the invariant that
fieldis terminated by a null pointer, as is done withargv. I.e., a table of n rows is an array of n+1 pointers, the last of which must always be null. This is a common C convention that obviates the need for an explicit count.