- 1、本文档共9页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言中地址操作符
C语言中地址操作符的使用(国外英语资料)
The address operator the use of C language
Categories: c++, 2012-04-11, 15:12, 1047 people read comments (0) collection report
Language ciostream compiler store
The directory (?) [+]
Example 1
01 #include stdio.h
02 int find (int *a);
03
04 main ()
{05
06 int b = 1;
07, int, wait, test;
08
09 test = find (b);
Ten
11 printf (memory address is:%d), test);
Twelve
13 scanf (%d, wait);
14}
Fifteen
16 int find (int *a)
{17
18 return *a;
19}
Int b = 1; int = test = find (b); when this is called, it is actually done: int*, a = b, and creates a new integer pointer to a, B, as a local variable within the range of the find function.
Example two
Function declaration: int find (int a); function call: int = b = 1; int n = find (B);
This is actually done when the call is made: int, a = B, and an alias A is given to the variable B, that is, a and B actually represent the same variable, and no new variables are created during the call.
Example three
Function declaration: int find (int a); function call: int = b = 1; int n = find (B);
In this case, the call is actually done: int a = B, that is, the normal variable assignment operation, created during the call of the local variable a within the range of the find function, and its value is the same as that of B.
Introduction to * and usage in C
when calculating, take the variable address, such as int* a = b, that is, the address of the integer variable B is taken out, assigned to the integer pointer a, and the content in a is the address of the B, so a points to B.
* when calculating, that is, the value in the address to which the pointer is pointing, such as int, B = *a, is to assign the contents stored in the address pointed to by the integer pointer a to the integer variable B.
In the C language, the symbol must be very familiar. It can be used as a bitwise function, as well as a more commonly used function -- to take variable addresses.
01 #include stdio.h
02
03 main ()
{04
05 int a = 0;
06 int wait;
07
08 i
文档评论(0)