in this presentation we will learn how
to access members of a structure using
structure pointer so let's get started
here is a program in which I have
declared a struct ABC which consists of
two members x and y both are of integer
type right and within this main function
I have a variable a of type struct ABC
and because I have a variable of type
struct ABC I would be able to access
these members using this variable
basically am assigning values to these
members using this variable a here X
will get value 0 and Y will get value 1
that is what we have learned in the
previous lecture right after that we
have a pointer to a variable of type
struct ABC so this is the pointer to
some variable of type struct ABC and in
this case it contains the address of
variable a and we can verify that
variable a is having type struct ABC and
this is also a pointer which is pointing
to some variable of type struct ABC
right so it must contains the address of
a variable of type struct ABC and that
is what it contains after that we have
the statement PTR arrow with X right
this pointer is pointing to the variable
X now what does this mean
PTR arrow X is equivalent to star PTR
dot X that means we will first
dereference the pointer and then we will
access the member so let me replace this
by star PTR dot X I can replace this PTR
by ampersand a right because PTR
contains the address of a now star and
ampersand gets canceled out which means
that we are left with a only so finally
if we left with a dot X which means that
we are accessing the member of this
variable a that is we are accessing this
member X of this variable a X contains
value 0 therefore this will get replaced
by 0 isn't that so similarly PTR Y can
be replaced by star PTR dot y which
means finally it will get replaced by a
dot Y and a dot Y can be replaced by 1
right so what is the output of this
program
0 and 1 so in this way we can access the
members of variable a using a pointer
that is what I have tried to explain in
this particular presentation ok
ok friends this is it for now thank you
for watching this presentation
[Applause]
[Music]