Double pointer in a loop

In the following example (from mysql source code), it uses the Field ** field. It’s hard for me to think that this is like a 2-dimensional field array.

typedef struct st_table_share  
{  
  .......  
  Field **field;           
  ....  
}  

for (Field **field=table->field ; *field ; field++)  
{  
    ...  

Can I think that a table contains many rows and a row contains several columns / fields. So * field means row, and field ** means table?

If true, for the following code

for (Field **field=table->field ; *field ; field++)

it will exit when * the field is zero, and how can * the field be zero if * the field is a string. Or can I say if the row has 5 columns and the field is the first column, then + 4 is the last field of the column, and + 5 is the end of the column, which means null, so the for loop will end?

+3
source share
4 answers

, *field , **field ?

.

*field null, *field

, field , argv. I.e., n n + 1 , . C, .

+4

, Field ** ?

Field ** . . , : , memcpy , . libusb, libusb_device ** () usb.

+1

, "*" . .. ( ) .

0

, 5 , - , + 4

, ,

+ 5 - , null

only if you initialized the array with zero completion.

And if you know how many columns your table has, you can iterate until you reach the last column instead ; *field ;.

0
source

All Articles