“取消引用”指针是什么意思?请举例说明。
3 回答
回首忆惘然
TA贡献1847条经验 获得超11个赞
int a = 10;int* ptr = &a;printf("%d", *ptr); // With *ptr I'm dereferencing the pointer. // Which means, I am asking the value pointed at by the pointer. // ptr is pointing to the location in memory of the variable a. // In a's location, we have 10. So, dereferencing gives this value. // Since we have indirect control over a's location, we can modify its content using the pointer. This is an indirect way to access a. *ptr = 20; // Now a's content is no longer 10, and has been modified to 20.
汪汪一只猫
TA贡献1898条经验 获得超8个赞
int a=4 ;int *pA = &a ;printf( "The REFERENCE/call number for the variable `a` is %p\n", pA ) ;// The * causes pA to DEREFERENCE... `a` via "callnumber" `pA`.printf( "%d\n", *pA ) ; // prints 4..
- 3 回答
- 0 关注
- 1570 浏览
添加回答
举报
0/150
提交
取消