*
声明一个指针.在写int *a
的时候,我通常会想到"int 102 a".
但接下来就会让人感到困惑:
int b = *a;
代表"int b is 103 of a",不代表"pointer of a".有了int *a = &b
,混淆就完美了,因为新的符号&
现在又代表了"104 of b".
有人知道这个会议背后的秘密逻辑吗?为什么*
不能简单地代表"pointer",&
代表"value"?或者这两个符号可以被认为是其他的话,这样就更有意义了?
编辑:这个问题与以下四个问题有何不同,这四个问题被链接为可能的重复,突出了相关问题和我的问题之间的差异
- Why is the dereference operator (*) also used to declare a pointer?(6个答案)
- Why use * notation to both define a pointer and dereference one?(1个答案)
- Why is the dereference operator used to declare pointers?(4个答案)
- Is the asterisk in the pointer declaration an operator?(3个答案)
我的问题是关于
-
*
和&
这两个符号背后的意图逻辑 -
*
和&
个符号是如何用文字来思考/表达的
链接的问题没有.除此之外,这些问题的答案都没有提到1978年K&;R的第90页,在那里它声称指针的声明是为了助记.这正是我要找的.