我又来了.在挖掘一些C源代码时,我发现了代码片段
char **words
Run Code Online (Sandbox Code Playgroud)
我知道变量名称之前的单个星号"指向"指针,但这两个星号的目的是什么?
Jan*_*n S 10
它是指向指针的指针.
它主要用于使用字符串数组时.
例如:你有char sample[5][5]; - 这可以存储5个长度为4的字符串;
如果你需要将它传递给一个函数,func(sample);
并且这种功能的功能定义是func(char **temp);
// your imagination is the limit
char letter;
char *word; // sequence of letters
char **sentence; // sequence of words
char ***paragraph; // sequence of sentences
char ****book; // sequence of paragraphs
char *****library; // sequence of books
Run Code Online (Sandbox Code Playgroud)
数据结构可能不是代表这个概念的最好方法:这只是一个例证。