0

Hi
Could anybody fill the table for me.
thanks

Declarations and initializations
int i=3,j=5,*p=&i,*q=&j,*r;
double x;

value               Equivalent expression          value
p==&i; 
**&p 
r=&x 
7**p/*q+7 
3**q-*p

What excutly means:
**&p
and
*&p

Ihave seen them somewhere, but I don't know what it means

thanks

4
Contributors
4
Replies
5
Views
11 Years
Discussion Span
Last Post by Bench
0

>>p==&i;
That is a logical expression, not an assignment. Its asking if the address stored in pointer p is the same as the address of i.

0

yeep
I know also that r=&x is an assignment statement and r is equall the address of x
7**p/*q+7 could be (Im not sure, can somebody correct me if not ) - 7*(*p/*q)+7
3**q-*p could be 3*(*q)-*p
but what about
**&p
*&p

thanks

0
**&p == *(*&p) == *p
*&*&*&x == *&*&x == *&x == x

unary & is the addressof operator; unary * is the dereference operator. so

&x

== address of x (pointer to x)

*&x

is dereference of the pointer to x ie. dereference address of x (== x itself).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.