J
Julie
Dan said:In said:Julie said:Irrwahn Grausewitz wrote:
Irrwahn Grausewitz wrote:What would you call p and *p, respectively?
int main(void)
{
int a = 1;
int *p = &a;
*p = 2;
return 0;
}
I call 'p' a "pointer [to an int]" and '*p' "p dereferenced" or "a pointer [to
an int] dereferenced".
So you think the term "variable" is applicable to neither p nor *p?
I'd call p a variable, but not *p.
I agree with you here.
How would you call *p, though? It has the semantics of a variable,
doesn't it?
I beg to differ, I'd rather say that p points to a variable.
That's something too subtle for Julie to understand. She seems to be
blind to the semantic difference between p (that can point to a variable)
and *p (that *is* the variable pointed to by p).
Dan -- your condescending attitude benefits no one in this newsgroup, and only
selfishly serves you.
I was speaking in general terms, not specifically. In the case of the code
posted, *p does point to a variable a, but only in this specific case. In
general terms, a pointer x *may* point to a variable.
Here are some examples of pointers that do *not* point to variables:
int * x = NULL;
const int b = 123;
const int * w = &b;
int * r = &printer_port_out;