[问题] address operator &

楼主: zzss2003 (brotherD)   2018-04-22 17:18:59
网址:
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?
谢谢。
作者: stupid0319 (征女友)   2018-04-22 18:48:00
我以为&不过就取内存位置,原来还有这么多的研究
作者: firose (guest也是也是也是也是也)   2018-04-22 19:04:00
据他所说 &A 跟 &A[0] 是不一样的型态,因为历史因素有自动转型为 pointer to array of int
作者: MOONRAKER (㊣牛鹤鳗毛人)   2018-04-23 14:53:00
不要看这篇。

Links booklink

Contact Us: admin [ a t ] ucptt.com