C++- Element selection through pointer |
Objectives:
- passing struct and pointer to struct as an
argument/parameter in a function.
- use of dereference(*) operator in a struct pointer.
- use of Element Selection (->) operator with pointer, also
called indirect membership operator
|
Step: 1 Create a project
|
Step: 2 Create a source file
|
Step : 3 Edit Source code
|
Step: 4 Runtime view
|
Step: 5 Using indirect membership operator (->).
- In the older version of C, the only way to pass a
structure as an argument.
- To pass a pointer to a structure as an argument, use
indirect membership operator(->) to access struct-members in the
function.
Note the use of indirect membership operator.
|
|
|