First of all, let’s consider the difference of three functions as follow:
void write(char a)
void write(char *a)
void write(char **a)
I am sure you have seen 1 and 2 functions, they respectively are passing-by-value and passing-by-address. The input of 1 can only be a char, the input of 2 can be a pointer to char or a char array. Both of them are easy to understand. But have you seen function 3? It’s confusing some times, because the input of 3 can be a pointer to pointer that point to char or a pointer to char array or a two dimensional char array. It is different when you code a function like 3, the difference as follows:
1 | //bm->read_block(unint32_t block_num,char *buf) |
As to case 2,do you think the following code is correct?
1 | void inode_manager::read_file(uint32_t inum, char **buf_out, int *size) |
The answer is incorrect. Do you know the reason?