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

Recommended Answers

All 4 Replies

>>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.

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

**&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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.