为什么要用双指针?或为什么使用指针的指针? [英] Why use double pointer? or Why use pointers to pointers?

查看:172
本文介绍了为什么要用双指针?或为什么使用指针的指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应在双指针C中使用?任何人都可以用一个例子解释一下吗?

When should a double pointer be used in C? Can anyone explain with a example?

我所知道的是,双指针指向的指针。为什么我需要一个指针的指针?

What I know is that a double pointer is a pointer to a pointer. Why would I need a pointer to a pointer?

推荐答案

如果你想有字符的列表(字),你可以使用的char *字

If you want to have a list of characters (a word), you can use char *word

如果您想要的单词列表(句子),您可以使用的char **一句

If you want a list of words (a sentence), you can use char **sentence

如果你想句子的列表(独白),你可以使用字符***独白

If you want a list of sentences (a monologue), you can use char ***monologue

如果你想独白的列表(传记),你可以使用字符****传记

If you want a list of monologues (a biography), you can use char ****biography

如果你想传记名单(生物库),可以使用字符***** biolibrary

If you want a list of biographies (a bio-library), you can use char *****biolibrary

如果您想要生物库的列表(??笑),你可以使用字符******笑

If you want a list of bio-libraries (a ??lol), you can use char ******lol

...

是的,我知道这可能不是最好的数据结构

这篇关于为什么要用双指针?或为什么使用指针的指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆