作者freehand1122 (免费的最贵)
看板C_and_CPP
标题[问题] 请问指标(pointer)一个基本的问题
时间Sun Mar 8 23:59:54 2009
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int y=5;
int *yPtr=&y;
printf("%d",*yPtr);
system("pause");
return 0;
}
第一个*代表"yPtr是指向int的指标",而第二个*是 "dereferencing operator"
请问我这样的解释有没有错误
这两个应该是不同的意思对吧?
因为我看书上没有强调两者的不同,但他们却又长一样,所以提出这个问题
希望各位高手帮忙解惑 感谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.204.98.210
1F:推 QQ29:用在宣告 就是指标阿 你讲的没错 03/09 00:01
2F:→ freehand1122:所以在非宣告的地方用*,全部都列为dereferencing o- 03/09 00:03
3F:→ freehand1122:perator罗? 03/09 00:03
4F:推 POSIX:不对 还有(int *) 作cast的时候也会用到 指向int的pointer 03/09 00:49