本文介绍了无法理解表示法:带指针的*和**的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的指针有问题.我知道这是怎么做的:
I have a problem with the pointers. I know what this does:
*name
我知道这是一个指针.
I understand that this is a pointer.
我一直在搜索,但是我既不了解它的功能,也没有找到有用的信息
I've been searching but I do neither understand what this one does nor I've found helpful information
**name
有人可以帮我吗?
推荐答案
考虑到您正在谈论这样的情况
Considering you're talking about a scenario like
-
char * name;
-
char **name;
char * name;
char **name;
在代码中,
-
*name
name
是指向char
的指针.
-
**name
name
是一个指向char
的指针.
name
is a pointer, to the pointer to a char
.
下面的视觉
如上所述,我们可以说
char value = `c`;
char *p2 = &value; // &value is 8000, so p2 == 8000, &p2 == 5000
char **p1 = &p2; // &p2 == 5000, p1 == 5000
因此,这里的p1
是指针到指针的指针.希望现在能使事情变得清楚.
So, p1
here, is a pointer-to-pointer. Hope this make things clear now.
这篇关于无法理解表示法:带指针的*和**的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!