Click to See Complete Forum and Search --> : Pointer


suresh
03-07-2001, 05:25 AM
Can you explain me the piece of code below with an example, in context with
pointers.

A->B

Regards
Suresh

beerbabu
03-07-2001, 06:26 AM
"suresh" <suresh.madurai@cspb.com> wrote:
>
>Can you explain me the piece of code below with an example, in context with
>pointers.
>
> A->B
>
>Regards
>Suresh

yera pointers telusukovadani kuda net kavala???? Yasvanth kranker book konukoni
chadhu anna.

bye
beer babu

sivakumar
03-07-2001, 06:54 AM
hai,

let b be an integer variable.

say

int b = 5;

then a be a pointer. say

int *a;

both a and b will have memory locations. now a can hold b integer value in
its address. lets assume b is got 100 as its address and 5 as it value

a can hold an address of an memory location which is got an integer value.
it's address is 200.

a = &b; means a is now pointing to a memory location(100) where an integer
data is stored.

*a is 5
a is 100
&a is 200

b is 5
& is 100.

hope you understood.

regards
cva

Danny Kalev
03-07-2001, 08:45 AM
suresh wrote:
>
> Can you explain me the piece of code below with an example, in context with
> pointers.
>
> A->B

A us a pointer to some object of type X. B is a member of X. The
expression above accesses the B member of the object to which A points.
A more realistic example:

struct Date
{
int day;
int month;
int year;
};

void f(Date * p)
{
p->year=2001;
}

Danny