作者zzss2003 (brotherD)
看板C_and_CPP
标题[问题] address operator &
时间Sun Apr 22 17:18:59 2018
网址:
https://stackoverflow.com/questions/49890211/address-operator-and-array-in-assembly-level
在Answer里面提到:
The address of & operator allows you to construct a pointer to value from a
variable of same type as value.
中文翻译:address operator允许你建构一个指标(from一个变数to value,且这个变数有
跟value一样的type)
请问,这一行的意思是不是指,当执行程式这一行时:
p = &var1;
&本身也会占用一个variable的空间(用来放var1的address),然後在把这个address给p?
接下来,内文提到:
int *p = &A;
程式在做这行指令时,you are doing an assignment from a pointer to array of int
into a variable of type array of int, which is a different type.
光看这行英文,哪有different type,一样是array of int啊
还是他打错了?应该是from a pointer to int into a variable of type array of int?
谢谢。
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.248.26.157
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1524388743.A.75B.html
1F:→ stupid0319: 我以为&不过就取记忆体位置,原来还有这麽多的研究 04/22 18:48
2F:→ firose: 据他所说 &A 跟 &A[0] 是不一样的型态,因为历史因素有自 04/22 19:04
3F:→ firose: 动转型为 pointer to array of int 04/22 19:05
4F:→ MOONRAKER: 不要看这篇。 04/23 14:53